You are viewing limited content. For full access, please sign in.

Question

Question

Make some inputs read only after submittion

asked on December 18, 2019

Hi,

I need to lock some input and drop down using javascript after clicking the submit button, but it seems not working, anyone please help? 

 

   $('.action-btn').on('click', function(){
     $('.testread input').attr({'readonly': 'True', 'backend-readonly': 'True'});
   $('.testread select').attr('disabled',true);
}); 

seems that the onclick fuction is not working, any ideas?

Laserfiche Forms Professional Version 10.4.1.172

0 0

Replies

replied on December 19, 2019

Hi William, can I ask what you are trying to accomplish? I'm assuming that you want to make the field read-only for other pieces of the process later on (for example, to make the drop-down read-only when a reviewer sees that field when he/she loads the form later in the business process).

When you submit a form, the actual HTML of the form doesn't save to the repository, only the variables that you capture from the form. In later steps of the process, when the form saves with the data populated or displays data previously entered, that's because the server is pushing the variables to a new instance of the HTML form and displaying that. So no changes to the HTML made with JavaScript make it past the submit button on a form, only the data captured in variables.

If you want to make the field read-only during later steps of the process, you will need to a) find some other condition to grab onto (like, "If the reject button exists, make these fields read-only") or b) use hidden fields and JS to populate different fields which are read-only.

Hope that helps, and let me know if I'm off the mark.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.