Clearing fields - InfoPath Dev
in

InfoPath Dev

Clearing fields

Last post 06-09-2006 07:04 AM by spudy. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 06-08-2006 03:35 PM

    • spudy
    • Top 150 Contributor
    • Joined on 03-23-2006
    • United Kingdom
    • Posts 67

    Clearing fields

    I have a view used to gather information. On completion the data is copied to a repeatig group. I want then to clear all the field values before the view is changed.

    I have all the code except that required to clear each field (there are over 70). Can anyone help?

    Thanks

    Paul
  • 06-08-2006 07:52 PM In reply to

    My suggestion here would be to create an XML file that has all of the nodes as blank and then add this as a secondary data source. When you want to clear all of the fields simply select the root node of the 2DS and the parent of the root node in the main dom and do parent.replaceChild( newChild, oldChild ).

    I hope this helps, there is a little more information in the SDKs! What language are you programming in? I might be able to provide an example myself.
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 06-09-2006 07:04 AM In reply to

    • spudy
    • Top 150 Contributor
    • Joined on 03-23-2006
    • United Kingdom
    • Posts 67
    Matt, thanks for your response.

    That is a good idea with the xml file. I have tried to do it with (js) code. I have fields called fielda1 through to fielda61 and I have tried to change the values with the following code:

    var i = 1;
    while ( i <= 61 )
    {
    var fieldaTitle = "//my:fielda" & i;
    XDocument.DOM.selectSingleNode(fieldaTitle).text = "";
    i++;
    }


    The error I get below relates to the line XDocument.DOM.....

    quote:

    Expression must evaluate to a node-set.
    -->0<--
    File:script.js



    I have used the structure of code to copy all of these fields to a repeating group so I do not understand why this fails here. Any ideas? Or should I give it up and use the method suggested with secondary data-source?
Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.