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

Question

Question

Why Can't I Make a Field Required and Read-Only?

asked on December 4, 2014 Show version history

In Forms 9.2 I am not able to make a field required and read-only at the same time. Why not? We need this ability for when we perform lookups. For instance, when an employees name is selected from a database lookup on a name field, we have it fill in additional information from our HR software. Sometimes the HR software is missing key pieces of information that we use for routing decisions in Forms. So the field needs to be required. At the same time, we don't want users to be able to fill in this information themselves as we want them to contact HR so the problem can be resolved, so it also needs to be marked as read-only.

We are currently using custom jQuery to accomplish this, but I was curious why it's not allowed natively.

3 0

Answer

APPROVED ANSWER
replied on December 4, 2014

Blake,

That is an interesting use case as you are basically using it to find problems in the lookup database where data is missing.

The intent is that we didn't want users to easily prevent forms from being submitted. In the basic scenario where you just have a single line field and you were to make that required and read only, a user wouldn't be able to normally fill out that field and then wouldn't be able to submit the form.

Even with the field being associated with a lookup, there's no guarantee that it will be filled with data, which is the case you're trying to catch and handle.

With custom javascript though, as you've mentioned, you can implement the form in this manner, and then you'd be able to handle things yourself, i.e. what happens when you do find the scenario that the required/read only field isn't getting populated by the lookup.

Regards

0 0

Replies

replied on December 4, 2014

okay, so you will need to do this by making it required. Then having javascript change the field to be read-only. The thing with Read-only fields is if you fill them in a lookup, the information doesnt proceed through to the variables in the process/other forms. You can have a field be both required and read-only if you do it by javascript.

0 0
replied on December 4, 2014

Kenneth, as I mentioned in my initial post, we are currently using jQuery to accomplish what we need, but I am curious why this is not allowed natively.

1 0
APPROVED ANSWER
replied on December 4, 2014

Blake,

That is an interesting use case as you are basically using it to find problems in the lookup database where data is missing.

The intent is that we didn't want users to easily prevent forms from being submitted. In the basic scenario where you just have a single line field and you were to make that required and read only, a user wouldn't be able to normally fill out that field and then wouldn't be able to submit the form.

Even with the field being associated with a lookup, there's no guarantee that it will be filled with data, which is the case you're trying to catch and handle.

With custom javascript though, as you've mentioned, you can implement the form in this manner, and then you'd be able to handle things yourself, i.e. what happens when you do find the scenario that the required/read only field isn't getting populated by the lookup.

Regards

0 0
replied on March 10, 2015

I agree with Blake that this needs to be an option as we don't want forms submitted where look-up information is missing.  Most of my customers would rather have the user's not be able to submit a form versus dealing with forms that are submitted incomplete.  

To get around this for now I've added a hidden field that is set to required.  This hidden field is filled at the same time as the read-only fields with one of the lookup values.  Even though the required field is hidden, Forms will not allow it to be submitted until it has a value. Not the most elegant solution but it keeps it from needing custom javascript.  To make it more obvious to the user, I have html that tells them they've entered an invalid value for the lookup whenever that hidden field is blank.

0 0
replied on April 21, 2016

Can someone provide the script to make it read only.

 

I have a few cases were we need required and read only as well.

Thanks

0 0
replied on April 21, 2016

This is now available in Forms 10.1.

0 0
replied on April 26, 2016

My company will not be upgrading to 10 until end of June. Is there a code i can use now in Java?

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

Sign in to reply to this post.