[InfoPath] uses jquery to assign a value to an Infopath form's field. How to set value to Infopath field by Jquery

Source: Internet
Author: User

The customer has a need to embed a piece of our own in an InfoPath form, and to update an InfoPath field after the calculation.

1. How to get to that field

Because the HTML produced by InfoPath is very complex, nested too much, followed by a messy ID, and when editing and viewing the ID is different, but each field in the HTML has a property called ' Originalid ', this ID is relatively fixed. So you can use this property to get the appropriate control.

For example: $ ("input[originalid= ' V1_i1_t9 ')")//This gets the input

2. How to assign a value to it, and when saving the form, the value of the successful deposit in.

In InfoPath, if you simply assign a value to a input in jquery and then save it, the value is not saved. We have to simulate something like someone going to actually fill out that value and then save it. Explanation after the reason.

$ ("input[originalid= ' v1_i1_t10 ')"). Val (Totalprice); Assign a value of $ ("input[originalid= ' v1_i1_t10 ')". focus (); Similar to the mouse focus placed in the text box is $ ("input[originalid= ' v1_i1_t10 ')"). blur (); Mouse Focus Left//This is a complete filling of the worthwhile process.

The reason is that in InfoPath, the real field value exists in a configuration file, and the value of the current HTML input or other control is changed, and when the mouse is moved, it triggers a process to write the value to the configuration file, so if you assign a value to jquery, Need to simulate a bit.

[InfoPath] uses jquery to assign a value to an Infopath form's field. How to set value to Infopath field by Jquery

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.