OnLoad Event - InfoPath Dev
in

InfoPath Dev

OnLoad Event

Last post 09-15-2005 07:16 AM by drobins. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 09-13-2005 08:27 AM

    • drobins
    • Top 500 Contributor
    • Joined on 08-17-2005
    • Canada
    • Posts 47

    OnLoad Event

    Is it possible during the OnLoad Event to have the value of a control checked and if it is equal to true set other controls to read only?

    can you set a control to read only through code?
  • 09-13-2005 09:55 AM In reply to

    Yes, on the OnLoad event you can do a check to see if a value is equal to another value.

    Read this tutorial that is posted on this web site -http://www.infopathdev.com/howto/tutorials/default.aspx?i=88f921f13dec4e7cae61191bac084fff

    What you are basically doing is writing your own custom functions that can return true/false and then use them in coniditional formatting. The advantage of doing this is you can centralize you conditional fomatting logic to one place.
    Jason
    http://www.k2distillery.com/
  • 09-13-2005 10:57 AM In reply to

    • drobins
    • Top 500 Contributor
    • Joined on 08-17-2005
    • Canada
    • Posts 47
    I was actually able to do it without using the xdExtension, although its probably more coding than needed.

    dim f6
    f6 = XDocument.DOM.selectSingleNode("//my:myFields/my:field6").text
    if f6 = "true" then
    XDocument.DOM.selectSingleNode("//my:myFields/my:field7").text = f6
    end if

    grab the value of field6.
    if it is true then set field7 to true.

    then in the conditional formatting of the fields i want to be read only i tell them if field7 is true then they are set to read only if not they are fillable.
  • 09-13-2005 11:41 AM In reply to

    If field7 in your case was name something like "readonly" and is of boolean type I think what you are doing makes sense.

    To play devil's advocate, creating a field in a schema for the sole purpose presentation may not be best. If the presentation can be determined from the state of the data in the form some developers would consider it better design to use xdExtension because no additional fields would have to be created. The reason why is if the XML schema for your InfoPath has business data and then there are InfoPath related elements in your schema, it will not integrate well with other layers of an enterprise solution. This is just a constructive comment I would give if I were doing a peer review with another developer.
    Jason
    http://www.k2distillery.com/
  • 09-14-2005 11:01 PM In reply to

    I agree with VT, use a secondary data source for presentation stuff. Otherwise the data sanctity of the XML form is compromised.

    Patrick Halstead [InfoPath MVP]
    InfoPathDev
    Patrick Halstead
    Project Manager at Qdabra
  • 09-15-2005 07:16 AM In reply to

    • drobins
    • Top 500 Contributor
    • Joined on 08-17-2005
    • Canada
    • Posts 47
    The more I learn the better.

    Again i was able to use rules with the open/save options rather than add fields.

    And now that I can get the users username I can apply a little bit of security to the form rather than using a hidden field that has had its value changed by a submit button

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