How to refresh form on clear button click? - InfoPath Dev
in

InfoPath Dev

How to refresh form on clear button click?

Last post 03-15-2013 02:04 PM by mrsneely77. 14 replies.
Page 1 of 1 (15 items)
Sort Posts: Previous Next
  • 12-08-2008 05:10 AM

    How to refresh form on clear button click?

    I want to clear all controls in clear button click. We can set a rule for each control but i have near about 300 controls. Is there any method to do this easily?

  • 12-08-2008 05:52 AM In reply to

    Re: How to refresh form on clear button click?

    Hi

     Add a button to your Form, called it Clear
    Add a rule to the button
    Select one action: Open a new form to fill in + the Form Template ID or location

    Frederik Van Lierde

    Frederik Van Lierde
    Blue InfoPath Blog  ¦  SilverSands Associate  ¦  Do you follow me already?  ¦  We work smart, not hard


    If this article was helpfull, don't forget to rate it, tnx!
  • 12-08-2008 06:16 AM In reply to

    Re: How to refresh form on clear button click?

    Hi Frederik Van Lierde 

    It gives error when we uses validation in that form. and it cannot work after two itterations.

     

    Thanks and regrds,

    Pundya.

  • 12-09-2008 12:14 AM In reply to

    Re: How to refresh form on clear button click?

    Hi please post some thing

  • 12-09-2008 12:53 AM In reply to

    Re: How to refresh form on clear button click?

    Hi,

    We can do this with code. Place all the controls in a group. In the button click event, replace that group node with the node which is taken from Sample data.

    Swathip
    www.ggktech.com
  • 12-09-2008 01:02 AM In reply to

    Re: How to refresh form on clear button click?

    How can we select that group programatically. what property does this?

  • 12-09-2008 01:32 AM In reply to

    Re: How to refresh form on clear button click?

    Hi,

    Add a Group in the main data source and move all the fields in to that group (ex: group5). After that place the following code in the clear button click event.

    [InfoPathEventHandler(MatchPath = "CTRL15_5", EventType = InfoPathEventType.OnClick)]

    public void CTRL15_5_OnClick(DocActionEvent e)

    {

    IXMLDOMNode groupNode = thisXDocument.DOM.selectSingleNode("/my:myFields/my:group5");

    IXMLDOMDocument2 sampleDataDom = (IXMLDOMDocument2)thisXDocument.CreateDOM();

    sampleDataDom.setProperty("SelectionNamespaces", "<write your form name space>");

    sampleDataDom.load("sampledata.xml");

    IXMLDOMNode sampleGroupNode = sampleDataDom.selectSingleNode("/my:myFields/my:group5");

     

    IXMLDOMNode groupParentNode = thisXDocument.DOM.selectSingleNode("/my:myFields");

    groupParentNode.replaceChild(sampleGroupNode, groupNode);

    }

     

     

    Here group5 -> is the group under which the controls are placed.

    myFields -> parent node of group5

    Swathip
    www.ggktech.com
  • 03-24-2009 09:58 AM In reply to

    Re: How to refresh form on clear button click?

    Perfect!  Exactly what i was looking for.  I did make one modification, and that was that I closed the existing form, not asking to save changes before opening the new form.  That way they don't end up with hundreds (in theory) of forms open, but only one at all times, either the one they are working on, or the new one they are submitting.  The idea is that they will submit via email before they clear.
    Chris Gray
    IT Technician (& more) :)
  • 06-02-2009 03:08 PM In reply to

    Re: How to refresh form on clear button click?

     You can use "New Record" option available in the button properties, which is basically resets all fields and ready to enter new record.

    Check the attached image


  • 06-23-2009 07:46 AM In reply to

    Re: How to refresh form on clear button click?

    I am trying to do something similar. I can't seem to find this option under my buttons though; I have a data connection to a web service from the infopath form.

  • 07-02-2009 12:02 AM In reply to

    Re: How to refresh form on clear button click?

    Strange, but I don't find the "New Record" option from the button properties.

    InfoPath Version: 2007 SP2 MSO

  • 07-02-2009 12:09 AM In reply to

    Re: How to refresh form on clear button click?

    Found the answer to my question, "If the form is connected to a database or Web service, this action clears the values on the form so that a user can enter new data."

    Source: http://office.microsoft.com/en-us/infopath/HA100964011033.aspx

  • 07-02-2009 12:11 AM In reply to

    Re: How to refresh form on clear button click?

    does your form uses database connection string? make sure your main dataset allows to submit the form. check this link http://office.microsoft.com/en-us/help/HA011199501033.aspx the action is created when you drag and drop the record set. try to drag a data set as table/detail view any other view...and then try looking the drop down again (you can delete the unnecessary table/detail view later)
  • 05-27-2010 11:17 AM In reply to

    Re: How to refresh form on clear button click?

  • 03-15-2013 02:04 PM In reply to

    Re: How to refresh form on clear button click?

    I am using InfoPath 2010 and my button properties doesn't have a New Form selection or anything like that. How is it that your version does?

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