This topic contains a post which is marked as Best Answer. Press here if you would like to see it.
*

atomo

  • **
  • 12 posts
Add readonly attribute to user type field in profile page
« on: October 30, 2018, 01:11:54 AM »
Hello.
How can I add the readonly attribute to the user type field dropdown, in profile page?
I don't want users to change their user type after registration. They must choose the user type on registration, but not be able to edit the field after that.
I've looked in the user profile php, and I know this is the element I need to add the readonly attribute:

             <?php UserForm::is_company_select(osc_user()) ; ?>

But how can I do it, as input / select code is not visible here?
Tks

*

MB Themes

Re: Add readonly attribute to user type field in profile page
« Reply #1 on: October 30, 2018, 07:28:16 PM »
@atomo
I think best way is to add readonly attribute via jQuery.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

atomo

  • **
  • 12 posts
Re: Add readonly attribute to user type field in profile page
« Reply #2 on: November 03, 2018, 04:42:36 AM »
Ok. Tks.
But how can I do it?
I know how to add in html, with some code like

Code: [Select]
<input type="text" name="user" readonly>
But this is different, and I can't handle it.
Any help is welcome.
Tks

*

MB Themes

Re: Add readonly attribute to user type field in profile page
« Reply #3 on: November 06, 2018, 10:23:46 AM »
@atomo
Check google how to do it via jquery.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

Marked as best answer by frosticek on February 03, 2019, 01:56:36 PM
*

atba

  • ****
  • 193 posts
Re: Add readonly attribute to user type field in profile page
« Reply #4 on: February 03, 2019, 12:35:32 PM »
I'll tell you))) It's simple !


<script>
        $(document).ready(function(){
            $('#you_id').prop('readonly', true);
        });
    </script>
osclass.by