Expand my Community achievements bar.

Require input conditionally

Avatar

Level 1

I've created a form with sections that require input based on whether or not a user has entered a title for that section.  However, I cannot get my the script to trigger a message box prior to submitting the form (using a custom button).  Basically, if the user enters any value for field1, they should be required to enter a value for field2

This may be a simple error but my experience with Javascript is limited.

form1.#subform[0].Button1::mouseDown - (JavaScript, client)

if (xfa.resolveNode("form1.#subform.TextField3")>"0" && xfa.resolveNode("form1.#subform.Reason_NatureofChange-1")=="0")

{

//xfa.host.messageBox("Please enter a Reason/Nature of Change for every change section submitted.")

}

Thanks in advance

2 Replies

Avatar

Level 9

Try this...

if (xfa.resolveNode("form1.#subform.TextField3").rawValue > 0" &&  xfa.resolveNode("form1.#subform.Reason_NatureofChange-1").rawValue ==0)

{

//xfa.host.messageBox("Please enter a Reason/Nature of Change for every change section submitted.")

}

Thanks,

Bibhu.

Avatar

Level 1

Thanks Bibhu

The addition of "rawValue" after the field name was something that I had missed but I'm still unable to get the script to function.

I've also discovered the use of // in javascript is similar to the ' in VBS.