Javascript to return Yes/No based on autolookup field value
Hello,
I'm trying to write some javascript that will be run when an eform autolookup control is run. Specifically, I would like a field to be set to "Yes" if the autolookup fills in a numeric value into a second field called "ListIDtextbox". If the autolookup does not fill in a value then I would like the script to fill in "No" in the field.
Here's what I have so far which functions to tell me the autolookup has run successfully. However, I believe I need to add an IF statement to this to also check the field for a value before it. The field name of the field I would like to check for the numeric value is called "ListIDtextbox". The Field where the Yes/No would appear is "ExistingJobDescriptionfound". Currently, the script puts 'Yes" in "ExistingJobDescriptionfound" when the autolookup runs regardless of if there is a value in "ListIDtextbox" Thanks for any pointers/examples you can provide on how to accomplish this.
function DescriptionFound()
{
var option = {fieldId : "ExistingJobDescriptionfound", value : "Yes"} ;
eFormHelper.setFieldValue(option, function(result)
{
if (result.isSuccess) //check if is success
{
console.log(result.data); //logs the data holds empty object
}
else
{
console.log(result.error); //logs the error
}
});}
-
Hello Michael,
Could you kindly provide details regarding the type of the controls labeled 'ListIDtextbox' and 'ExistingJobDescriptionfound'?
Additionally, could you please confirm whether the mentioned auto lookup consistently returns numeric values?
This information is necessary for the development of a JavaScript solution tailored to specific use case.
Thank you.
Please sign in to leave a comment.
Comments
1 comment