Code execution from normal field - InfoPath Dev
in

InfoPath Dev

Code execution from normal field

Last post 10-24-2010 11:11 PM by Tuomo Ilonen2. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 10-20-2010 02:20 AM

    Code execution from normal field

    Hello,

    I use coding behind buttons to get only one record from secondary data connection. But now I have too many button clicking in my form.

    Is it possible to write code behind normal field and execute this query immediately after leaving the field? I can have these in-built rules after field is filled why couldn't I then havealso rules in the code.

    How I can do it?

  • 10-21-2010 12:10 AM In reply to

    Re: Code execution from normal field

    You can. You can use xdExtension::<procedure> to call code from a rule's condition (Greg blogged this many years ago - please search for it). This let's you mix rules with code. You can also just use code.

    To write just code (without the rules), add an OnAfterChange event by selecting Tools->Programming and Changed Event (via IP2007 command menu)

     

    Patrick Halstead
    Project Manager at Qdabra
  • 10-24-2010 11:11 PM In reply to

    Re: Code execution from normal field

    Thanks Patrick, Programming the fields seemed to be enough for my needs at this point.

    Still I have problem with secondary data fields. Once I retrieve value to them, I wonder why this same value cannot be forwarded to main connection field instantly.

    I know I'm not much of a codewriter but this line I have in my code after the data has been retrieved to secondary connection:

    XDocument.DOM.selectSingleNode("/dfs:myFields/dfs:dataFields/d:fwdq_vend_main_info/@postal_code").text = XDocument.DOM.selectSingleNode("/dfs:myFields/dfs:dataFields/d:vwdq_cust_post_city_harmonized/@City").text;

    So I have main connection field that is supposed to get value from the secondary connection field, but it doesn't do it. I noticed this kind of problem already when trying to built this functionality with built-in rules.

Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.