Default Value of Textbox Not Updating Database! - InfoPath Dev
in

InfoPath Dev

Default Value of Textbox Not Updating Database!

Last post 01-18-2006 11:38 AM by Paradice29. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 01-18-2006 09:47 AM

    Default Value of Textbox Not Updating Database!

    Hi,

    I have an order form that pulls all of its information from a web service. On the form I have textbox's that have calculated Default Values so that when changes are made in other textbox's the changes are recalculated. Everything works great when you make any changes that cause the Default Value to be recalculated. But where I am running into issues, is when there are no changes that need to be made and the Default Value is not recalculated. The textbox I have the Default Value set is NULL in the database by default. When I pull it into the form via the webservice, the calculated Default Value replaces the NULL value. But if no changes are made to the form and I hit Update, the Default Value is not written to the database. I tried to use a Rule that basically says that "Quantity = Quantity" in an effort to make it "change" the value of the textbox to the Default Value that has been calculated. But since that textbox is in a repeating table, it just takes the value of the first row and applies it to all the rows "Quantity" textbox. Tried to use current(), but it is not working at all. Can someone please help!!!

    Thanks In Adavance!
  • 01-18-2006 10:03 AM In reply to

    Re: Default Value of Textbox Not Updating Database!

    You could add a rule to the calculated field that says "if calculated field is blank calculated field = EQUATION".

    A way to do it with code is as follows, but I suggest sticking with the first option.

    You will want to roll through all of the rows of the repeating table and "touch" each node so that the value is recalculated. Check out this code (put in your onLoad):

    var rows =XDocument.DOM.selectNodes( "/my:myFields/my:group1/group2" );

    while( row = rows.nextNode() )
    {
    row.selectSingleNode( "my:value1" ).text = row.selectSingleNode( "my:value1" ).text;
    }

    I hope this helps, let us know if there are any more questions!

    ---------------
    Matt Faus
    InfoPath Dev Texas
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 01-18-2006 11:38 AM In reply to

    Re: Default Value of Textbox Not Updating Database!

    Matt,

    Thanks for your response. I tried to use the Rule you suggested, but to no avail. The name of the textbox field is "ActualQty", it has a default value of "0" generated by the database (it is not actually NULL) and my Rule looks like this:

    Rule 1

    Condition: ActualQty = 0

    Action:
    Set a fields value: . = OrderQty + StoreAdj + CommAdj (this is them same formula I use for the default value)

    When I update the order it still does not pickup the calculated values. When I remove the Default Value calculation, it shows in the database default value of "0", instead of the calculated value I would expect from the Rule I setup. Any clues?

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