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

Question

Question

User Task - certain fields in the form needs to be marked read only in CSS javascript

asked on September 8, 2020

I have a process where the form gets initiated and gets assigned to the employee by supervisor. 

In the form i have a multiline field for supervisor to enter notes, which needs to be made read only in the user task step (where the user acknowledges the form) 

 

Similarly i have a field with multiple checkboxes which the supervisor clicks and submits the form. The form goes to the employee who needs to acknowledge the form. So in this step i need the checkbox field to be made read only.

 

Am trying to accomplish both fields to be marked read only in my css javascript . But for certain reason am unable to. Am able to mark other fields read only but just this multiline and checkbox am having an issue.

 

      $('#q46 input').prop('readonly', true); //q46 is the multiline field$
     

$('#q42 input').prop('readonly', true); //q42 is the checkbox field with 6 to 7 checkboxes listed and supervisor can select multiple checkboxes.

Any idea why just these 2 fields am unable to mark read only in the usertask stage. Should the above format be different?

   
 

0 0

Answer

SELECTED ANSWER
replied on September 8, 2020

Hi Rekha,

The element for multi-line field is textarea instead of input, which means $("#q46 textarea").prop("readonly", true); will make the field read-only.

 

As for checkbox, the id is different to simple fields and varies among options. So the selector would be like $("input[id^='Field42']"), see more details in https://www.laserfiche.com/support/webhelp/Laserfiche/10/en-US/administration/#../Subsystems/Forms/Content/Javascript-and-CSS/Javascript%20Selectors.htm#CommonlyusedjQueryselectorsinForms

On the other hand, readonly attribute cannot make checkbox option to be read-only style. Alternative is to set disable attribute. See explanation in https://answers.laserfiche.com/questions/167453/Making-one-of-the-checkbox-option-read-only#167456

1 0
replied on September 9, 2020 Show version history

Worked perfect. Thankyou very much!

 

 

0 0

Replies

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

Sign in to reply to this post.