solved Lock user input for some fields in own module

WebServices
WebServices
@swenmaertin
4 years ago
11 posts
Hello,
I have a question about the function jrCore_form_field_create.

Is it possible to lock the editing of single fields if the user is not admin. I would like to have a list of information filled out by the user in a own module (e.g. address information). But there are fields (e.g. membership number), which the user should not be able to change. In the example of the membership number, however, this should be displayed anyway.

Thanks a lot

updated by @swenmaertin: 06/30/20 09:05:21PM
paul
@paul
4 years ago
4,330 posts
You can add a 'readonly' to the jrCore_form_field_create array and this will gray out the form -

           $_tmp = array(
                'name'     => 'product_qty_ignore',
                'label'    => 'Membership Number',
                'type'     => 'text',
                'value'    => $membership_number,
                'readonly' => 'readonly',
                'required' => false
            );
            jrCore_form_field_create($_tmp);

Hope that helps?


--
Paul Asher - JR Developer and System Import Specialist

Tags