Skip to main content
Participant
Jan 8, 2018 12:12 PM UTC
Question

Lock Fields on Validation?

I want to have 2 text fields lock but only after a correct validation of proper initials from an individual. I have a script to lock fields and s script to validate. How do I put the two together?

Validate:

event.rc = true;

if (event.value != "" && event.value != "AAAA" && event.value != "BBBB")

{

    app.alert("The entered value needs to be either 'AAAA' or 'BBBB'!");

    event.rc = false;

}

Lock:

var fieldsToLock = ["TimeField309", "TimeField317"];

for (var i in fieldsToLock) this.getField(fieldsToLock)

How do I put these 2 together for the proper result I'm looking for?

This topic is closed to new replies. Start a new post to keep the conversation going.

4 replies

try67
Community Expert
Community Expert
Jan 8, 2018 1:05 PM UTC

Why are you using a text field, then? Use a drop-down field and the user will have to select one of the allowed options.

Translate
Participant
Jan 8, 2018 2:10 PM UTC

A time will go in the text field to be locked, which could be any time of the day. Too many options for a dropdown.

Translate
try67
Community Expert
Community Expert
Jan 8, 2018 2:32 PM UTC

I'm talking about the original text field, the one with "AAAA" or "BBBB" options...

Translate
Bernd Alheit
Community Expert
Community Expert
Jan 8, 2018 12:33 PM UTC

You can use:

if ( ... ) {

} else {

}

Translate