Dear Sir/Madam,
I have a link to create child post with parameter passing
<a href="/add-new-contestant/?parent_vwcm-application_id=[wpv-post-id]&mode-type=[types field='type' output='raw'][/types]"><span class="badge badge-success">Create Child Post</span></a>
From the child add new form, I have a custom select field which will accept the parameter mode-type
[cred_field field='contestant-mode' force_type='field' class='form-control' output='bootstrap' value='[wpv-search-term param="mode-type"]']
I tried two jQuery script to disable the field not to be changed
jQuery("select[name='wpcf-contestant-mode']").prop('disabled',true);
or
jQuery("select[name='wpcf-contestant-mode']").attr('disabled', 'disabled');
or remark the field
<!--
[cred_field field='contestant-mode' force_type='field' class='form-control' output='bootstrap' value='[wpv-search-term param="mode-type"]']
-->
After I saved the form, only the field wpcf-contestant-mode doesn't save data to the database, may I know how I can disallow user to change the value?
Hello and thank you for contacting Toolset support.
Do not use the last option as it will completely remove the field from the form. So, when submitted, the form will not have a value for the field.
<!--
[cred_field field='contestant-mode' force_type='field' class='form-control' output='bootstrap' value='[wpv-search-term param="mode-type"]']
-->
Instead, try to make the field read only with the following Javascript code:
jQuery("select[name='wpcf-contestant-mode']").attr('readonly', 'true');
I hope this helps. Let me know what you will get, and if you have any further questions.