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

Question

Question

Populating Read-Only Field from Query String Does not Work

asked on March 17, 2014

I have a query string that is passing values to LF Forms. I tested to make sure everything works by not making the fields read-only first. Once I verified the fields were being populated correctly, I made the fields read-only. Once I did that, the fields stopped being populated. How can I pass a value from a query string into a read-only field?

0 0

Answer

APPROVED ANSWER SELECTED ANSWER
replied on March 17, 2014 Show version history

If a field is set to read-only when design the form on Edit page, Forms don't allow passing value through URL to that field for security reasons. You can use JavaScript the set the fields as read-only instead if you do want to pass value through URL. For example, you can add a CSS class named "read-only" to the fields, then in JavaScript, you can use following script to set the fields as read-only:

1$(document).ready(function(){ 
2   
3  $(".read-only *").prop("readonly", true);
4});

 

0 0

Replies

You are not allowed to reply in this post.
replied on March 17, 2014

Read-only elements cannot be modified in the front end for security reasons.  If you are not concerned that a person can change the read-only data with a url change then you can make a field read-only by custom script.   

 

Add class 'makereadonly' to the field in advanced tab.

 

then add this script to your custom 

$(document).ready(function() {
$(".makereadonly input").attr('readonly',true);
});

You are not allowed to follow up in this post.

Sign in to reply to this post.