Hi,
I have a form asociated to a table.
In "Form Code" tab, in "Form HTML" I have added a hidden field:
When I show this form in frontend I can see this field (viewing the source html of the page, of course). And its value is "tronco".
However, if I assign this form to a chronoconnectivity conexion as the "Record Edit Form", when editing a row, if I view the html code of the page:
i.e. the value is empty.
what is happening?
If you need access to my wev, please tell me.
Thanks a lot.
I have a form asociated to a table.
In "Form Code" tab, in "Form HTML" I have added a hidden field:
<input id="myfield" name="myfield" value="tronco" type="hidden">
When I show this form in frontend I can see this field (viewing the source html of the page, of course). And its value is "tronco".
However, if I assign this form to a chronoconnectivity conexion as the "Record Edit Form", when editing a row, if I view the html code of the page:
<input id="myfield" name="myfield" value="" type="hidden">
i.e. the value is empty.
what is happening?
If you need access to my wev, please tell me.
Thanks a lot.
Hi jrariasf,
The Edit Record code reloads the form values from the corresponding database record. I'm guessing that there is no value for 'myfield' in the database - and possibly no column. If so the ChronoConnectivity id behaving logically.
I'm not quite sure why you'd need a fixed value in an editable record though?
If you do then you could probably re-write the value with JavaScript after the form has loaded.
Bob
The Edit Record code reloads the form values from the corresponding database record. I'm guessing that there is no value for 'myfield' in the database - and possibly no column. If so the ChronoConnectivity id behaving logically.
I'm not quite sure why you'd need a fixed value in an editable record though?
If you do then you could probably re-write the value with JavaScript after the form has loaded.
Bob
Thanks GreyHead.
Really, I have not a fixed value. I have something like:
Now I know that there must be a field in the database called "myfield" (or "myuser").
I will try in other way.
Thanks again.
Really, I have not a fixed value. I have something like:
<input id="myuser" name="myuser" value="<?php echo $user->username; ?>" type="hidden">
Now I know that there must be a field in the database called "myfield" (or "myuser").
I will try in other way.
Thanks again.
Hi jrariasf ,
You never need to have the username in the form like this. You can always get it from the Joomla! User object after the form is submitted.
Bob
You never need to have the username in the form like this. You can always get it from the Joomla! User object after the form is submitted.
Bob
Good morning,
I imagine the "Yser objetc" you say is:
is this true?
By the way, in previous message you tell me "you could probably re-write the value with JavaScript after the form has loaded".
Could you tell me how can I do that?
I tell you what I have done:
1.- I have a table with 10 fields (one of this fields is "text_12").
2.- I have a form named "inscribirme_a_padel" to change the field "text_12".
3.- In the form, in "Form Code" tab, in "Form HTML" I have this:
And in "Form JavaScript" I have:
4.- I have a "ChronoConnectivity conection" where the "Record Edit Form" is "inscribirme_a_padel".
When viewing the registers of the table, I show an "{edit_link}" in each row.
5.- If I click in the "edit_link" appears the form "inscribirme_a_padel" and when I click in the field then is called the "PutValue" javascript function.
Thats all right.
But...how can I re-write the value with JavaScript after the form has loaded without clicking the field?
* I have attached an screen capture with the form.
[attachment=0]screencapture.JPG[/attachment]
** A possible solution could be to add the onClick to the submit button. But I would like to know if exists a way of "re-write the value with JavaScript after the form has loaded".
I imagine the "Yser objetc" you say is:
$user = &JFactory::getUser();
is this true?
By the way, in previous message you tell me "you could probably re-write the value with JavaScript after the form has loaded".
Could you tell me how can I do that?
I tell you what I have done:
1.- I have a table with 10 fields (one of this fields is "text_12").
2.- I have a form named "inscribirme_a_padel" to change the field "text_12".
3.- In the form, in "Form Code" tab, in "Form HTML" I have this:
<?php
// Get user-information from Joomla
$user = &JFactory::getUser();
?>
<div class="form_item">
<div class="form_element cf_textbox">
<label class="cf_label" style="width: 150px;">J1+</label>
<input class="cf_inputbox" maxlength="150" size="30" title="" id="player_one" name="text_12" value="<?php echo $user->username; ?>" type="text" onclick="PutValue();" />
</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_button">
<input value="Submit" name="button_4" type="submit" />
</div>
<div class="cfclear"> </div>
</div>
And in "Form JavaScript" I have:
function PutValue()
{
document.ChronoContact_inscribirme_a_padel.text_12.value='new_value';
}
4.- I have a "ChronoConnectivity conection" where the "Record Edit Form" is "inscribirme_a_padel".
When viewing the registers of the table, I show an "{edit_link}" in each row.
5.- If I click in the "edit_link" appears the form "inscribirme_a_padel" and when I click in the field then is called the "PutValue" javascript function.
Thats all right.
But...how can I re-write the value with JavaScript after the form has loaded without clicking the field?
* I have attached an screen capture with the form.
[attachment=0]screencapture.JPG[/attachment]
** A possible solution could be to add the onClick to the submit button. But I would like to know if exists a way of "re-write the value with JavaScript after the form has loaded".
Hi jrariasf ,
Apologies for my typo : Yser = User
This is a lot of work for something that isn't necessary but here's one way of doing it:
Not tested but should work OK the only problem is that you need to make sure that this runs after the ChronoForms script that is re-loading the values.
Bob
Apologies for my typo : Yser = User
This is a lot of work for something that isn't necessary but here's one way of doing it:
?php
// Get user-information from Joomla
$user = &JFactory::getUser();
$script = "
window.addEvent('domready', function() {
$('player_one').value = '{$user->username}';
});
";
$doc =& JFactory::getDocument();
$doc->addScriptDeclaration($script);
?>
<div class="form_item">
<div class="form_element cf_textbox">
<label class="cf_label" style="width: 150px;">J1+</label>
<input class="cf_inputbox" maxlength="150" size="30" title="" id="player_one" name="text_12" value="" type="text" />
</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_button">
<input value="Submit" name="button_4" type="submit" />
</div>
<div class="cfclear"> </div>
</div>
Not tested but should work OK the only problem is that you need to make sure that this runs after the ChronoForms script that is re-loading the values.
Bob
This topic is locked and no more replies can be posted.