Skip Validation On Submit For Hidden Fields - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Skip Validation On Submit For Hidden Fields

Last post 05-15-2009 02:56 PM by infoman. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 05-06-2009 09:41 PM

    Skip Validation On Submit For Hidden Fields

    Hi,

    I am unable to submitt the form due to validation error on some hidden fields.

    On the Data Validation for the control, I have set the conditions as follows:

    Fire validation only if

    control is present and

    control is blank

    But the infopath form displays with message that validation is required on submit even if the control is hidden.

    Control is within a section which is also hidden.

    Any help is greatly appreciated. 

     

     

     

  • 05-07-2009 02:58 AM In reply to

    Re: Skip Validation On Submit For Hidden Fields

    Hi,

    When will you show that field in the form to the user? Use the same condition for validating the field. For example, you are showing the hidden field when field 1 is not blank then add the validation as field1 is not blank and hidden field is blank. If field is present will return true if it is there in template.xml rather than checking in the form.

    Swathip
    www.ggktech.com
  • 05-08-2009 10:55 AM In reply to

    Re: Skip Validation On Submit For Hidden Fields

    Hello:

    First, if you don't already know this, do not check the "Cannot be Blank" button in the Properties dialog.  Instead, manually set validation rules and conditions that determine whether a control/field can or cannot be blank.

    Second, even if a control is not visible (hidden), it still is "present" on the form unless you programmatically delete it.  So you can't set "is not present" as the condition for skipping validation.  The control is still there, just invisible.

    I use several methods to bypass the validation step for a hidden field.  See if one of these works for you:

    1. Use option buttons to determine whether or not a field/group/section is visible.  With your control that cannot be blank:
      • Set a rule that will only validate the control if the user selects Option A
      • If Option B is selected, the control is made invisible and validation is never called
    2. With many forms, I can't use Roles and Views because the forms are sent outside our server domain.  So, in order to get the same effect -- determine field visibility, disable or enable buttons, set controls to read-only, or trigger validation only under certain conditions -- I include an invisible section with various fields whose values are set according to different states in the workflow or values the user has selected on the form. 

      For example on one form I include an invisible "Status" textbox.  Then I set the Status field's value according to the stage in the workflow.
      • If the form has not yet been submitted, Status = "New"
      • If the form has been sent, Status = "Sent", exposing new functions and disabling others
      • If the job has been completed, Status = "Completed" and the "Completed" view and messages are sent back to the initiator/

    In scenario 2 above, a whole host of validation rules, field display conditions, and alternate functions are set depending upon the value of "Status."  With that trick, you can get the same functionality as roles and views.  That "invisible field" trick also works well for setting conditions for validation.

    Hope some of this helped.

    Noel C. Gordon
  • 05-14-2009 08:05 PM In reply to

    Re: Skip Validation On Submit For Hidden Fields

    Thank you all for valuable suggestions.

    I ended up replacing the condition not present to the condition I had placed to hide the control in the first place. That worked perfectly.

    I have conditional formatting logic setup to hide/show control based on certain field values on the infopath form. I just replace the not present condition

    with that condition.

    Again, Thanks for your help.

    However, I am still facing another situation related to submitt option.

    I have two submitt buttons on the form. One button uses the default submitt properties to submtt data to web service which after clicking data

    displays infopath message box "Loading Data To Server"

    How can I display the same message after I click my custom submitt button. Seems like this message is available only on main form submitt option.

    Any suggestion is greatly appreciated. 

     

     

     

     

     

  • 05-15-2009 07:59 AM In reply to

    Submit using Rules; Re: Skip Validation On Submit For Hidden Fields

    When you are submitting to more than one destination, I think it is better NOT to use the default submit options.

    Instead, use the "Perform custom action using Rules" option (Tools > Submit Options ...).  Then create custom buttons inside your form for each Submit function.

    From the button properties dialog for each button, create Rules and Conditions for each data connection.  This way, you can have dialogs pop up for each data connection whenever you want with whatever messages you want.

    (If you wished and if your circumstances permit, you could create just one custom "Submit" button and then, after the button is clicked, choose which data connection to use based on other values or conditions in your form.)

    What NOT to do:

    1. In "Submit Options", do NOT check the box for "Show the Submit menu item ... toolbar button".  (You'll be creating your own submit button(s).
    2. Since you will manage Rules and Conditions for each data connection from the button's Properties, there's no need to click on the"Rules..." button in the "Submit Options" dialog
    3. If you do open the "Rules for Submitting Forms" dialog, leave ALL the checkboxes for data connections unchecked (blank).  You do not want to set or select a single 'main' data connection.  If you do, the rules for that main connection will override any unique rules you have set for the other connections.

    Hope that works for you.

    Noel C. Gordon
  • 05-15-2009 02:56 PM In reply to

    Re: Submit using Rules; Re: Skip Validation On Submit For Hidden Fields

    Hi,

    As you have suggested use the "Perform custom action using Rules" option (Tools > Submit Options ...).  Then create custom buttons inside your form for each Submit function

    I have created two custom buttons in the form. Each button has different submit functionality.

    One button saves data from the form to sql server database, another button calls web service method for another action.

    I am specifying submit action on both buttons via button properties -> button action Submit from the dropdown list.

    However, I can not seem to create two separate rule sets for button it gets overidden.

    Am I missing something ?

    Instead of Submit action, Do I have to choose Rules and Custom Code from action from the action list?

    Please advice.

     

     

     

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