Fire rules on a control via code - InfoPath Dev
in

InfoPath Dev

Fire rules on a control via code

Last post 06-04-2008 08:47 AM by Michael Vasquez. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 05-28-2008 01:35 PM

    • admot
    • Top 500 Contributor
      Male
    • Joined on 08-09-2006
    • USA
    • Posts 51

    Fire rules on a control via code

    I have a pull down control that sets an attribute's value based on the selection. This attrribute is referenced by a hyperlink.

    Example: If "Apples" is selected in the pull down, a rule tells the link to point to an apples website. If "Oranges" is selected in the pull down, a rule tells the link to point to an oranges website.

     The problem is if I update the template and re-open the form, the form doesn't update its link OnOpen.

     

    Is there a way to run all the control's rules on a loadevent? Below, the control is called FruitSelection.

    function msoxd_my_FruitSelection::OnLoad(eventObj)

    {

     //

    }

     

    Do I just toggle it manually using code?

    Don't grow old regretting the things you didn't do.
  • 05-29-2008 06:10 AM In reply to

    Re: Fire rules on a control via code

    I would either put this in a rule or onchange for the dropdown or make the defualt value for the hyperlink based upon the dropdown value and have it update automatically.

    You have a field for the hyperlink text and are then using that field for the hyperlink path correct?

  • 05-29-2008 11:47 AM In reply to

    • admot
    • Top 500 Contributor
      Male
    • Joined on 08-09-2006
    • USA
    • Posts 51

    Re: Fire rules on a control via code

    I tried that approach but was unsuccessful. The problem is the user may open the form without toggling the control. If the control isn't toggled, the link will still be the old value.

     I found a solution where OnLoad, I set the value of the control to itself (if initially not null) . This "jolts" the control's rule to fire which in turn updates the link.

     Thanks for the response!

    Don't grow old regretting the things you didn't do.
  • 06-04-2008 08:47 AM In reply to

    Re: Fire rules on a control via code

     Could you show a sample of code you did to do the above.  I want to be able to run a rule when I click on a button to run a rule.

     TIA  

    Mike
     

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