Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

SIL Live fields on Edit screen

Krithica Gowri Shankar
Contributor
May 29, 2018

Hi,

I have a validation for date field such that Date 2 should not be before Date 1 else pop up an error message.

I want this to be applied on Edit screen. With the live fields i get the error message if  the condition fails but once i change to correct value still the error message is appearing and the script fails.

Below is my script. Please let me know what i miss and how to achieve this.


if(argv["screen"] == "edit") {
if(argv["date2"]<= argv["date1"]) {
lfShowFieldMessage("date2", "errormessage", "ERROR");
}
else
{
lfHideFieldMessage("date2");

}

}

Thanks,

Krithica

1 answer

1 accepted

2 votes
Answer accepted
Wouter Bruinings
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 29, 2018

I would advise you to create a main and a hook script using the lfWatch to respond to javascript events, as explained here.

In the main script configure both the date fields to respond to a javascript event, for example, the "click" event as a date is commonly selected from the box by clicking (Or pick any event that suits your needs better). 

In the hook, script use the code you are currently using. 
The code will be executed each time someone clicks the screen. So it should reevaluate once you do select the correct dates and hide the message again. 

Krithica Gowri Shankar
Contributor
May 29, 2018

Thank You so much. This works.

Wouter Bruinings
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 30, 2018

Happy I was able to help!

Suggest an answer

Log in or Sign up to answer