[Skip to main content](#vessel-content)

#   Prefilled and read only custom field

##

- **[mett](/forum/user/1080-mett "View mett's Profile")**
- [![mett's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/1080-mett "View mett's Profile") Topic Author
- [ Offline](/forum/user/1080-mett)

Less More

- Posts: 126
- Thank you received: 2
-
-

15 years 5 months ago [\#17561](#17561) by [mett](/forum/user/1080-mett "View mett's Profile")  *[Prefilled and read only custom field](/forum/4-how-to/17561-prefilled-and-read-only-custom-field#17561 "Hello Nicolas,  I added a custom field to address table which should include user &quot;username&quot; data. I would like to auto complete this field and make it read only..how can i do that?  thank you")* was created by *[mett](/forum/user/1080-mett "View mett's Profile")*

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

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzE3NTYxLXByZWZpbGxlZC1hbmQtcmVhZC1vbmx5LWN1c3RvbS1maWVsZD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86561
- Thank you received: 14307
-
-

15 years 5 months ago [\#17564](#17564) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: Prefilled and read only custom field](/forum/4-how-to/17561-prefilled-and-read-only-custom-field#17564 "Hello Nicolas,  I added a custom field to address table which should include user &quot;username&quot; data. I would like to auto complete this field and make it read only..how can i do that?  thank you")*

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](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzE3NTYxLXByZWZpbGxlZC1hbmQtcmVhZC1vbmx5LWN1c3RvbS1maWVsZD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[mett](/forum/user/1080-mett "View mett's Profile")**
- [![mett's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/1080-mett "View mett's Profile") Topic Author
- [ Offline](/forum/user/1080-mett)

Less More

- Posts: 126
- Thank you received: 2
-
-

15 years 5 months ago [\#17578](#17578) by [mett](/forum/user/1080-mett "View mett's Profile")  Replied by *[mett](/forum/user/1080-mett "View mett's Profile")* on topic *[Re: Prefilled and read only custom field](/forum/4-how-to/17561-prefilled-and-read-only-custom-field#17578 "Hello Nicolas,  I added a custom field to address table which should include user &quot;username&quot; data. I would like to auto complete this field and make it read only..how can i do that?  thank you")*

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.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzE3NTYxLXByZWZpbGxlZC1hbmQtcmVhZC1vbmx5LWN1c3RvbS1maWVsZD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86561
- Thank you received: 14307
-
-

15 years 5 months ago [\#17579](#17579) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: Prefilled and read only custom field](/forum/4-how-to/17561-prefilled-and-read-only-custom-field#17579 "Hello Nicolas,  I added a custom field to address table which should include user &quot;username&quot; data. I would like to auto complete this field and make it read only..how can i do that?  thank you")*

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](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzE3NTYxLXByZWZpbGxlZC1hbmQtcmVhZC1vbmx5LWN1c3RvbS1maWVsZD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[mett](/forum/user/1080-mett "View mett's Profile")**
- [![mett's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/1080-mett "View mett's Profile") Topic Author
- [ Offline](/forum/user/1080-mett)

Less More

- Posts: 126
- Thank you received: 2
-
-

15 years 5 months ago [\#17581](#17581) by [mett](/forum/user/1080-mett "View mett's Profile")  Replied by *[mett](/forum/user/1080-mett "View mett's Profile")* on topic *[Re: Prefilled and read only custom field](/forum/4-how-to/17561-prefilled-and-read-only-custom-field#17581 "Hello Nicolas,  I added a custom field to address table which should include user &quot;username&quot; data. I would like to auto complete this field and make it read only..how can i do that?  thank you")*

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 ![:)](/media/kunena/emoticons/3.png ":)")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzE3NTYxLXByZWZpbGxlZC1hbmQtcmVhZC1vbmx5LWN1c3RvbS1maWVsZD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86561
- Thank you received: 14307
-
-

15 years 5 months ago [\#17582](#17582) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: Prefilled and read only custom field](/forum/4-how-to/17561-prefilled-and-read-only-custom-field#17582 "Hello Nicolas,  I added a custom field to address table which should include user &quot;username&quot; data. I would like to auto complete this field and make it read only..how can i do that?  thank you")*

What I would do is this:
edit the file registration of the view user via the menu Display-&gt;Views and add the code:

if($fieldName=='cod_agent'){
$user =&amp; JFactory::getUser();
$field-&gt;field_value = $user-&gt;username.'::'.$user-&gt;username;
}

just after the line: foreach($this-&gt;extraFields[$type] as $fieldName =&gt; $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](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzE3NTYxLXByZWZpbGxlZC1hbmQtcmVhZC1vbmx5LWN1c3RvbS1maWVsZD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.170 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
