Hi
I am trying to create a form that looks up name on two different fields from the Juser database, can any one advise how to do this
thanks
chris
I am trying to create a form that looks up name on two different fields from the Juser database, can any one advise how to do this
thanks
chris
Hi chris,
Usually you can get all of the User information from the Joomla! JUser Object e.g.
Bob
Usually you can get all of the User information from the Joomla! JUser Object e.g.
<?php
$user =& JFactory::getUser();
echo $user->name;
echo $user->id;
?>
Bob
Hi Bob
Thanks for the reply, I have got that to work to populate withthe logged in user. Is there a way to read all users and select them from a drop down list ?
Sorry if these seem easy or stupid questions, I am new to this and trying to incorporate a form on a charity website
Thanks
Chris
Thanks for the reply, I have got that to work to populate withthe logged in user. Is there a way to read all users and select them from a drop down list ?
Sorry if these seem easy or stupid questions, I am new to this and trying to incorporate a form on a charity website
Thanks
Chris
Hi Chris,
Yes you can - gets a bit long if you have many users though. What exactly do you need to do here?
Bob
Yes you can - gets a bit long if you have many users though. What exactly do you need to do here?
Bob
Hi Bob
Thanks for the reply the first part is now fine as it takes the name from the logged in User. I need a second field named "riders Name" that will give me a drop down box with all users registered in Juser
Thanks
Chris
Thanks for the reply the first part is now fine as it takes the name from the logged in User. I need a second field named "riders Name" that will give me a drop down box with all users registered in Juser
Thanks
Chris
Hi Bob
Thanks for the code, but it only picks up users that are authors or above, I would like it to read registered users as well ?
Thanks
chris
Thanks for the code, but it only picks up users that are authors or above, I would like it to read registered users as well ?
Thanks
chris
Hi chris,
My oversight - needed to look deeper in the docs:
Bob
My oversight - needed to look deeper in the docs:
echo JHTML::_('list.users', 'user_id', true, 0, NULL, 'name', false);
should do it.Bob
Hi Bob Thanks for the info before, I just have one last query I have the following set which shows all the registered users but when the form is saved and exported to Excel the rider_name field only shows the user_id from J-User. Can I change this to show the Actual Name
Thanks
<div class="form_item">
<div class="form_element cf_dropdown">
<label class="cf_label" style="width: 150px;">Rider Name</label>
<select class="cf_inputbox" name="rider_name"<?php echo JHTML::_('list.users', 'user_id', true, 0, NULL, 'name', false); ?>
</div>
Thanks
Hi pinec1975 ,
Not using the JHTML code. Probably the best way is to do the conversion when the form is saved. Use the id to look up the name from the OnSubmit Before box and save that in an extra column in the database.
Bob
Not using the JHTML code. Probably the best way is to do the conversion when the form is saved. Use the id to look up the name from the OnSubmit Before box and save that in an extra column in the database.
Bob
Thank you bob. I get it.
But if i want to list all the id of user, how does it happen?
Because this only shown list of user name.
Really appreciate.
Thank You.
But if i want to list all the id of user, how does it happen?
Because this only shown list of user name.
Really appreciate.
Thank You.
Hi Bob
[list]Hi pinec1975 ,
Not using the JHTML code. Probably the best way is to do the conversion when the form is saved. Use the id to look up the name from the OnSubmit Before box and save that in an extra column in the database.
Bob[/list]
How does this happen on chronoform v3?
[list]Hi pinec1975 ,
Not using the JHTML code. Probably the best way is to do the conversion when the form is saved. Use the id to look up the name from the OnSubmit Before box and save that in an extra column in the database.
Bob[/list]
How does this happen on chronoform v3?
This topic is locked and no more replies can be posted.