0

I am working with SP2013 with InfoPath Designer 2013.

I have created a browser based InfoPath form with certain field. I have kept this form on Page using InfoPath Form WebPart. Now I want to validate the field of InfoPath field using JavaScript code.

I just want to ensure that none of my fields are empty at the time of submitting the form.

I know this can be done using InfoPath Rule, but somehow the requirement is to do this with JavaScript code. I just need to add some sort of JavaScript code in the CEWB on the page and my validation should work.

Any help or references are most welcomed.

0

1 Answer 1

3

Load your IP form in the browser and then inspect it with the Developer Tools (F12). InfoPath creates all kinds of crazy IDs whose names are impossible to anticipate, and they might even change, so you'll need jQuery to identify neighboring elements by things like their style and then traverse to the elements you really need to check. It can be done but it's painful and a waste of time.

It's a five-minute job with InfoPath, so you may want to ask the person who is requesting that you do the validation with JavaScript for a justification.

Tell them that you will probably spend a week doing this with JavaScript and jQuery, whereas it would take five minutes with InfoPath.

If they are happy with that, take the chance to upskill. :-))

1
  • I guess you covered the main concept in your answer. So I am closing this.. :-) Commented Jun 27, 2017 at 11:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.