Making read-only and hidden fields editable when updating a form as an admin.

By: Andre Larmet | Asked: 01/23/2025
ForumsCategory: General questionsMaking read-only and hidden fields editable when updating a form as an admin.
Andre Larmet asked 12 hours ago

I have a user profile form that contains 2 read-only fields and one hidden field. As the admin, I bring up the form in a page for edit purposes. The read-only fields are showing up as read only and the hidden field is not showing up. I thought that by using some php code, I could make those fields editable by changing the type to "text". This is the first time I am trying to use php code and snippets in Fforms and I am lost as to how it all works. What I have as a snippet in WPcode plugin: I used a sample snippet used to hide fields and changed it to what I thought would do the reverse operation. add_filter('frm_field_type', 'change_my_field_type', 10, 2); function change_my_field_type($type, $field) { echo 'got here'; if(in_array($field->id, array(67,121,125))) { //fields 67,121,125 should now be text fields and editable   if(is_admin())//if current user is admin echo 'got here'; $type = 'text'; //show the fields   }   return $type;   I put an echo statement to see if the code is even run.   The question is How and Where do I invoke this code in my form?   I have contacted tech support but they don't seem to understand my question. They keep pointing me to the same docs that I have read over and over without finding the answer to my question. I am not asking to have code written for me, I am asking how to use, invoke, trigger the code within the Fforms framework.   Any insight is appreciated   Andre  

1 Answers
Bobby Clapp answered 3 hours ago

How the code runs is going to be dependent upon how you've set it up in WPcode:


https://wpcode.com/docs/run-code-snippets-on-demand/


The code snippet needs to be active and probably set as shown in the first image in step 2.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right