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

Question

Question

Using JavaScript to Pass URL Info to a Read-Only Field

asked on January 9, 2014 Show version history

Morning Folks,


I have been following the last thread on using Java to pass URL to a Forms field. However, what is required when you want to write to a read-only field.

 

Why are we doing this?

 

We are embedding Forms into our Members' Area portion of our website (log-in is required). We want to pass the Member ID to the Form ( we can do now), but not allow the End User to edit that particular field.


Any help would be greatly appreciated!

 

1 0

Answer

APPROVED ANSWER SELECTED ANSWER
replied on January 9, 2014

Basically, instead of setting the field to read-only on the Edit page, you'll use JavaScript to set it to read-only once the value has been filled. Since you're passing the value in with a URL parameter, the field is already filled when the document is ready, so something as simple as the following code should work.

 

$(document).ready(function () {
    $('.ro input').attr('readonly','True');
})

On the Edit page, select the field you're filling in and, and its Advanced tab, give it the ro CSS class.

0 0

Replies

replied on January 9, 2014

you would want to have the javascript enable and then disable the field

0 0
replied on January 9, 2014

Eric! Worked like a charm!

 

I love Laserfiche Answers!

0 0
replied on August 24, 2015 Show version history

Eric,

This does not appear to work for Date fields or Dropdown fields. Dropdown fields are editable and appear editable. Date fields are grayed out like they aren't editable, but if you click the calendar they are.

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

Sign in to reply to this post.