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

Question

Question

when moving information from one form to another how to make pre-populated fields read only

asked on April 22, 2020

I'm working on creating a process where form 1 is initiated in-house and using workflow to create a link sent to a client outside of the organization (non-LF-licensed). I am using the process explained here https://www.laserfiche.com/ecmblog/tech-tip-dynamically-generate-laserfiche-forms-urls/> and it is working successfully. 

My question is once form 2 is received how do I make the pre-populated fields view/read only? - I have tried to changed the Field Options on the form to "Read-Only" in which case the form then does not pre-populate at all, looks like all grayed out fields. Also tried to add a section and make it read only, same results.

 

Thank you all, any advice is appreciated!

0 0

Answer

SELECTED ANSWER
replied on April 23, 2020 Show version history

You would only need to replace the number after the '#q' with whatever field it is. You can find these in the CSS and JavaScript page in the preview window on the right.

The last one, the .focus, isn't needed.

So for this:

If I want the first three read-only, it'd be this:

$(document).on("onloadlookupfinished", function(event) {
  $('#q1 input').attr("readonly", "True");
  $('#q2 input').attr("readonly", "True");
  $('#q3 input').attr("readonly", "True");
});

0 0

Replies

replied on April 22, 2020

Try setting the readonly attribute to true on load.  Like this...

$(document).on("onloadlookupfinished", function(event) {
  $('#q25 input').attr("readonly", "True");
  $('#q31 select').focus();
});

0 0
replied on April 22, 2020

Thank you James, on your script above, do I replace the "q line#" and repeat for every value on the form that gets auto populated? How about the (document) any replacements there?

0 0
SELECTED ANSWER
replied on April 23, 2020 Show version history

You would only need to replace the number after the '#q' with whatever field it is. You can find these in the CSS and JavaScript page in the preview window on the right.

The last one, the .focus, isn't needed.

So for this:

If I want the first three read-only, it'd be this:

$(document).on("onloadlookupfinished", function(event) {
  $('#q1 input').attr("readonly", "True");
  $('#q2 input').attr("readonly", "True");
  $('#q3 input').attr("readonly", "True");
});

0 0
replied on April 23, 2020 Show version history

The focus method makes the first data entry field active.  I find that helps the user and speeds up data entry.  Yes, you need to access the CSS and JavaScript tab to determine what numbers your fields have.  Good luck and have fun.

And remember that someone who knows what's going on, can change the parameters in the link and reload the page to change the values, so do some validation in the workflow.

0 0
replied on April 23, 2020 Show version history

Hi James,

So, I did as you said my case is like this:

 $(document).on("onloadlookupfinished", function(event) {
  $('#q3 input').attr("readonly", "True");
  $('#q4 input').attr("readonly", "True");
  $('#q6 input').attr("readonly", "True");
  $('#q8 input').attr("readonly", "True");
  $('#q9 input').attr("readonly", "True");
  $('#q10 input').attr("readonly", "True");
  $('#q18 input').attr("readonly", "True");
  });

But, I tested it and it is still allowing edit on those fields 

replied on April 23, 2020

It worked! thanks so much James!

0 0
replied on April 23, 2020

@████████

One concern with the above solution (that I see James also mentioned) is that it is not entirely secure. A user could simply change the value in the URL or go into the browser's dev tools and remove the read-only attribute and change the values before submitting. If you need these values to be a little more secure, there is a more complex way you can achieve this. 

Instead of passing over each value Department=X, Building Code=Y... you could store each value in a database with a corresponding ID number. For example, you could store in the database ID=12x5j3, Department=Finance, BuildingCode=1234, RoomNumber=213. When you send off the URL, instead of passing over the raw data, just pass over the ID=12x5j3 and store it in a hidden field. You could then make the rest of the fields read-only on the form and have a lookup grab the values based on the ID. It would be much more secure in that the fields are actually read-only on the form and are subject to back-end validation. It also makes it much more difficult for a user to randomly guess other IDs to retrieve information that isn't for them. 

3 0
replied on April 23, 2020

I haven't had the need, but thanks for the suggestion. I'll keep it in mind.

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

Sign in to reply to this post.