- Posts: 126
- Thank you received: 2
Prefilled and read only custom field
15 years 4 months ago #17561
by mett
Prefilled and read only custom field was created by mett
Hello Nicolas,
I added a custom field to address table which should include user "username" data. I would like to auto complete this field and make it read only..how can i do that?
thank you
I added a custom field to address table which should include user "username" data. I would like to auto complete this field and make it read only..how can i do that?
thank you
Please Log in or Create an account to join the conversation.
15 years 4 months ago #17564
by nicolas
Replied by nicolas on topic Re: Prefilled and read only custom field
There is no such option. Could you explain why you would like to do that ? There is probably another easier way to do it...
Please Log in or Create an account to join the conversation.
15 years 4 months ago #17578
by mett
Replied by mett on topic Re: Prefilled and read only custom field
Now only firstname and lastname are auto completed, but i need to get also the username.
When user has completed a new address, i would like to auto complete a custom field (named cod_agent) with his username. This custom field would be great to be read-only so user cannot change information.
When user has completed a new address, i would like to auto complete a custom field (named cod_agent) with his username. This custom field would be great to be read-only so user cannot change information.
Please Log in or Create an account to join the conversation.
15 years 4 months ago #17579
by nicolas
Replied by nicolas on topic Re: Prefilled and read only custom field
Could you explain what you do with that cod_agent field later on ? You could probably directly use the username from the joomla user table directly instead of having an additional field in the addresses for it.
Please Log in or Create an account to join the conversation.
15 years 4 months ago #17581
by mett
Replied by mett on topic Re: Prefilled and read only custom field
We use this site for our partners. Sometime, they use one general account(office) to make orders. What we need to do is to force user to login and make orders using their own account. It's a long story, trust me
Please Log in or Create an account to join the conversation.
15 years 4 months ago #17582
by nicolas
Replied by nicolas on topic Re: Prefilled and read only custom field
What I would do is this:
edit the file registration of the view user via the menu Display->Views and add the code:
if($fieldName=='cod_agent'){
$user =& JFactory::getUser();
$field->field_value = $user->username.'::'.$user->username;
}
just after the line: foreach($this->extraFields[$type] as $fieldName => $oneExtraField) {
and I would make that cod_agent field of the type dropdown or radio.
That should display in the registration form a radio/dropdown field with only one value which would be the username.
edit the file registration of the view user via the menu Display->Views and add the code:
if($fieldName=='cod_agent'){
$user =& JFactory::getUser();
$field->field_value = $user->username.'::'.$user->username;
}
just after the line: foreach($this->extraFields[$type] as $fieldName => $oneExtraField) {
and I would make that cod_agent field of the type dropdown or radio.
That should display in the registration form a radio/dropdown field with only one value which would be the username.
Please Log in or Create an account to join the conversation.
Time to create page: 0.190 seconds