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

Question

Question

Forms- Make particular fields read only for submitter

asked on July 25, 2018

On Lasefiche Forms, is it possible to make particular fields read-only for the submitter but then for those fields to be writable on the next step? I know this can be accomplished by doing a copy of the form, however, wanted to see if it is possible without having to do copies of the form.

1 0

Replies

replied on July 25, 2018

Currently, you'd have to use JS to set up a field as read-only based on step ID.

I got something close that may work for you depending on your Form set up.

I have Field A as an editable field, and Field B has a read-only field. Field A has a default value (whatever you want to show to the submitter) and Field B used a formula to match Field A. At this point, whatever is the default value for Field A shows in both fields, but Field A is editable and Field B is read only. Next I have a field rule based on a radio button. If the radio button is set to Initial Form, only Field B shows which is the read only field showing that default value. If I switch the radio button to Approval Form, the editable Field A shows up with that same value. 

The tricky part is determining if there is anything on your form you can replace my radio button with. You don't want to give the submitter the right to switch the radio button and edit the form, so you could try and base it on a username or something similar. Otherwise, you'd have to resort back to JS. 

In the future, we are planning enhancements to field rules that would allow you to control a field's required state based on conditions and allowing the stage and step to be used as conditions.  

2 0
replied on July 25, 2018

My solution to this has always been to create a copy of the form, set the field(s) to read-only on one, and editable on the other, then set the form associated with each user task accordingly.

However, I did put in a feature request and was told that these types of issues were already on the radar so they may make their way in eventually.

https://answers.laserfiche.com/questions/142734/Feature-Request-StepTask-Based-Field-Rules#142810

replied on July 31, 2018 Show version history

That is very complicated for something simple.

 

Here goes.

  1. Find a required field that will always be visible -- if this field has data in it on form load then it is not the first time the form is loaded. I am assuming that this field that you have chosen has a class of "requiredField" but you can adjust to fit.
  2. Add the class to your fields you want to be readonly called "readonly" (do not forget that multiple classes can be added to a field, you simply separate them with spaces).
  3. Put this code:
$(function() {
	if ( $(".requiredField [vo]").val() === "" ) {
		$(".readonly [vo]").attr("readonly", true).attr("disabled",true);
		
		$("#form1").submit( function() {
			$(".readonly [vo]").attr("readonly", false).attr("disabled",false);
		});
	}
});

 

And sorted. You will have read only fields the first time that form is loaded.

 

No code version:

  1. Create hidden field called something like "Initial Stage" and make its default value "true".
  2. Create field rule that says if "Initial Stage" is equal to "true" hide these fields (instead of making them read only).
  3. Now add a simple workflow step immediately after the initial submit that changes that "true" to "false"
  4. ????
  5. Profit.

 

1 0
replied on July 25, 2018

My solution to this has always been to create a copy of the form, set the field(s) to read-only on one, and editable on the other, then set the form associated with each user task accordingly.

However, I did put in a feature request and was told that these types of issues were already on the radar so they may make their way in eventually.

https://answers.laserfiche.com/questions/142734/Feature-Request-StepTask-Based-Field-Rules#142810

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

Sign in to reply to this post.