how to clear text box on click on that text box? - InfoPath Dev
in

InfoPath Dev

how to clear text box on click on that text box?

Last post 06-29-2015 06:28 AM by SearchKnowledge. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 12-08-2008 05:19 AM

    how to clear text box on click on that text box?

    Hi

     I want to clear that text box when clicking on that. just like following url.

    https://www.northernnaturalgas.com/infopostings/asp/gasConnection/marketGC.asp

    In this url there is one section " Contact Name & Email Address" below that some text boxes are present. By default they contain some text and when you click on that text disappers. i want same effect in infopath.

     

    Please help.

    Pundya

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

    Re: how to clear text box on click on that text box?

    Hi

    1.Open infopath in design mode

    2.Open Properties window of the text box by right clicking on the Text box

    3.Select 'Text Box Properties' Option

    4.In Properties window,select the Display Tab

    5.Enter the 'Primary contact name here' in Placeholder text box

    6.Click Ok.

    7.Save the Form.

    Madhuri
    http://www.ggktech.com
  • 12-08-2008 05:40 AM In reply to

    Re: how to clear text box on click on that text box?

    yes Madhri you are right...

    but i want to clear that text box when you click to enter text in that.

    i want this functionlity.

  • 12-08-2008 08:21 PM In reply to

    Re: how to clear text box on click on that text box?

     Hi,

    Add OnContextChange event to the form and write the code to empty the field if the event is address field.

    Ex:

    [InfoPathEventHandler(EventType = InfoPathEventType.OnContextChange)]

    public void FormEvents_OnContextChange(DocContextChangeEvent e)

    {

    if (e.Context.nodeName == "my:field8")

    {                     thisXDocument.DOM.selectSingleNode("/my:myFields/my:field8").text = "";

    }

    if (e.Type == "ContextNode")

    {

    // The XML selection or context has changed.

    // Write your code here.

    return;

    }

    }

     

    Here my:field8 -> Address field

    /my:myFields/my:field8 ----> is the xpath of the Address field.

    Swathip
    www.ggktech.com
  • 12-08-2008 11:05 PM In reply to

    Re: how to clear text box on click on that text box?

    Thanks swathip

    Its help me a lot

    Pundya

  • 06-29-2015 06:28 AM In reply to

    Re: how to clear text box on click on that text box?

    >> XPathNavigator navigator2 = this.MainDataSource.CreateNavigator(); I am trying to clear the textbox like this: navigator2.SelectSingleNode("/my:Fields/my:role/my:tbox1").text = ''; //there is no "text" for the method. How can I achieve it? I am trying to clear that textbox.
Page 1 of 1 (6 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.