Validation event by clicking a button - InfoPath Dev
in

InfoPath Dev

Validation event by clicking a button

Last post 10-19-2010 05:58 AM by nthaka1. 11 replies.
Page 1 of 1 (12 items)
Sort Posts: Previous Next
  • 01-09-2007 08:28 AM

    Validation event by clicking a button

    Hi all,

    I have a repeating table with different datas. Every field has a validation event. The validation events should be fired when I click the button. The validation should not be fired after leave a field.
    Can anybody help me to use the problem?
    Thanks.
  • 01-09-2007 12:44 PM In reply to

    Re: Validation event by clicking a button

    Hi Mancha,
    This is by design. InfoPath does data type and conditional validation when you finish editing the field. You can't postpone that.
    Patrick Halstead
    Project Manager at Qdabra
  • 01-09-2007 11:57 PM In reply to

    Re: Validation event by clicking a button

    Hi Patrick,

    thanks for your reply.
    And can I call an OnValidate event again when I click the button by using the EventHandler?

  • 01-10-2007 01:05 AM In reply to

    Re: Validation event by clicking a button

    Yes, you can implement an OnValidate event handler which will be called. You can also write OnBeforeChange and OnAfterChange event handlers. Have fun!
    Patrick Halstead
    Project Manager at Qdabra
  • 01-10-2007 01:23 AM In reply to

    Re: Validation event by clicking a button

    Hi Mancha,

    You can call Onvalidate event for fields by following steps.
    1.Double click on any field.
    2.Click on DataValidation.
    3.Select "OnValidate" event in Events drop down and click on Edit button and write the code.

    You do not need to use Button.

    OnValidate event Occurs after changes to a form's underlying XML document have been accepted but before the OnAfterChange event occurs.

    The OnValidate event is typically used for handling errors and working with the Errors collection

    I Hope this will help for you.

    Thanks.

    K.Ramana Reddy / http://www.ggktech.com
    India.
  • 01-14-2007 11:30 PM In reply to

    Re: Validation event by clicking a button

    Hi,

    I know the OnValidate event. But my problem is all OnValidates events of the textfields should be called when I click the button.
    The button checks the values against a database. If a value doesn't exist in the database the textfield should be red marked. The check should not be run after the change of a textfield.
    Is there another possibility to solve this?

  • 01-16-2007 01:24 AM In reply to

    • Shiva
    • Top 25 Contributor
    • Joined on 04-15-2005
    • India
    • Posts 694

    Re: Validation event by clicking a button

    Hi Mancha,

    If you want validation on your field after clicking the button then you need to write code in onClick event. In this event depends on your validation you can set set ‘true#%92 or ‘false#%92 value to some other new field (either main DOM or secondary DOM). Depends on new field value you can set the validation on your field in InfoPath.
  • 01-16-2007 06:24 AM In reply to

    Re: Validation event by clicking a button

    Hi Shiva,

    can you give me an example? I'm not sure what you mean.
    Thanks.
  • 01-16-2007 10:21 PM In reply to

    • Shiva
    • Top 25 Contributor
    • Joined on 04-15-2005
    • India
    • Posts 694

    Re: Validation event by clicking a button

    Hi Mancha,

    First of all I am confirming your requirement is, when you enter data in text box and validation method will call when you click on the button right.
    For this you need write code in OnClick event: In this you check values against a database and if doesn#%92t exist in the database set ‘true#%92 value for one new field (my:validate) using below code. This field data type is ‘True/False Boolean#%92 and default value is ‘false#%92.

    i(validation())
    {
    XDocument.DOM.selectSingleNode(“/my:myFields/my:validate”).text = “true”;
    }
    ese
    {
    XDocument.DOM.selectSingleNode(“/my:myFields/my:validate”).text = “false”;
    }

    And in validation () method you need to write code for which type of you want to validate on that field. If will return ‘true#%92 for if the text field data does not exist in database otherwise it returns ‘false#%92. Depends on new field (my:validate) value you put the validation on that field should display red marked.

    If you don#%92t want to write code for this, you need to calculate the same functionality in InfoPath and using rules you can set the true or false to new field. And do the same validation on your field using the new field value (my:validate).
  • 01-18-2007 03:45 AM In reply to

    Re: Validation event by clicking a button

    Thanks all for your replies.

    I have found another solution. I check many fields in the OnClick event. If an value doesn't exist in the database I set an error object to the element.
    XDocument.Errors.Add(...)
    The field will be red marked.
  • 09-09-2010 03:00 AM In reply to

    • Disha
    • Not Ranked
    • Joined on 09-02-2010
    • Posts 2

    Re: Validation event by clicking a button

    Hey ...

    I am facing the same problem.

    Can you please give a detailed explanation of the method you put in the 'Onclick' event of the button to add validation to the field.

    tia

     

     

  • 10-19-2010 05:58 AM In reply to

    Re: Validation event by clicking a button

     Hi Disha,

    If you are using InfoPath 2007 and Browser-compatible form, then while setting validation uncheck the "Show error message immediatly" option.

     

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