Hi,
I need to capture the username and put it into a text field read only. In chronoforms V3 I know how to do this by editing the source code, but in V4 I don't.😢
I only have achieved to get the username placing a "custom code" action before "show html". The "custom code" is
Now I need to put it into a text field. I tried to put <?php echo $user->username; ?> on text field value, but don't work.
Thanks a lot. 😀
I need to capture the username and put it into a text field read only. In chronoforms V3 I know how to do this by editing the source code, but in V4 I don't.😢
I only have achieved to get the username placing a "custom code" action before "show html". The "custom code" is
<?php
$user =& JFactory::getUser();
echo $user->username;
?>
Now I need to put it into a text field. I tried to put <?php echo $user->username; ?> on text field value, but don't work.
Thanks a lot. 😀
Hi guillegm,
Please use this in the Custom Code action
Bob
Please use this in the Custom Code action
<?php
$user =& JFactory::getUser();
$form->data['username'] = $user->username;
?>
Bob
Hi guillegm ,
Three ways: [list=a]Use a Custom element and put {username} in it; you also need a hidden input if you want to have the value in the form results.
Edit the Form HTML on the Form code tab and put readonly='readonly' in the input tag
Use a JavaScript snippet to set readonly after the page loads
later: Use a Custom element and put {username} in it (see gabedaly's post below) [/list:o]
Bob
Three ways: [list=a]
Bob
This topic is locked and no more replies can be posted.