Hello,
I have chronoforms v4 installed in my site and have created a form, including a "label text" which purpose is to be filled with the name of the user. This form is intended to registered users only. The idea was to retrieve the name of the user and fill it automatically in this field.
I found somewhere (here in the forum ?) the following code:
I then placed it like this in the field code:
It does work well, when I open the form, the user's name is populated.
But, the form's purpose is to add entries in my sql database through a "DB save" action. Then, I can display it as a spreadsheet within an article with the "Table JX" plugin.
After having submitted the form, what I find in my database is the user ID ("172" for instance) in the "ch_user_id" field.
What can I do so that "172" is replaced by the full name of my user ?
Thanks😉
I have chronoforms v4 installed in my site and have created a form, including a "label text" which purpose is to be filled with the name of the user. This form is intended to registered users only. The idea was to retrieve the name of the user and fill it automatically in this field.
I found somewhere (here in the forum ?) the following code:
<?php
$user =& JFactory::getUser();
if ($user->guest) {
echo "";
} else {
echo $user->name;
}
?>
I then placed it like this in the field code:
<label>Your name</label><input value="<?php
$user =& JFactory::getUser();
if ($user->guest) {
echo "";
} else {
echo $user->name;
}
?>" maxlength="150" size="30" class="" title="" type="text" value="" name="input_text_1" />
It does work well, when I open the form, the user's name is populated.
But, the form's purpose is to add entries in my sql database through a "DB save" action. Then, I can display it as a spreadsheet within an article with the "Table JX" plugin.
After having submitted the form, what I find in my database is the user ID ("172" for instance) in the "ch_user_id" field.
What can I do so that "172" is replaced by the full name of my user ?
Thanks😉