Help! How to accomplish multiple field validation! - InfoPath Dev
in

InfoPath Dev

Help! How to accomplish multiple field validation!

Last post 01-16-2008 03:11 PM by keeter. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 01-16-2008 08:05 AM

    Help! How to accomplish multiple field validation!

    Ok, first off this is somewhat complicated to explain.  But I'll give it a shot.  I'm develpoing a set of forms (each will behave the same, but have different fields.)  On the forms there is a submit button.  When the button is clicked, in the rules section of the button, we 1) Set a status field to submitted, 2) Switch views to an email that gets sent 3) Submit using a data connection 4) Switch views to a "form submitted view, and then 5) Submit the form to the appropriate SharePoint library.

    The aforementioned process works well EXCEPT, if you have to validate fields (make sure they have an entry) before you submit.  I'd thought of setting a condition on the rules, but that only allows you to set 5 conditions, and I have to make certain that more than 5 fields have data in them.  So my next attempt was to try to do the above programmatically in vb.  However InfoPath prevents you from switching views more than once programmatically.

     My main goals are this (but can't seem to accomplish them...)

    1) Verify certain fields have data in them before submit is allowed.

    2) Send an email to a supervisor alerting them a form has been submitted.

    3) Submit the form.

     

    Any help you may be able to afford would be GREATLY appreciated!

     

  • 01-16-2008 01:54 PM In reply to

    Re: Help! How to accomplish multiple field validation!

    Welcome to the forum.

    You can add validation to the field in its properties, which will offload some of this. Does standard validation not work for you?

    You could also set up some dedicated fields for custom validation, each one monitor a set of fields and return true or count the number of fields that meet validation and then use these for conditionals at time of submit. 

     

  • 01-16-2008 01:58 PM In reply to

    Re: Help! How to accomplish multiple field validation!

    Thanks.  I've gotten a similar (less complicated) method to work correctly in "preview" mode.  However the _changed event doesn't get triggered when the field in question loses focus when the code is on Forms Server.

     Is there a way to force a _changed event when the code sits on Forms Server?

     

    Thanks,

     

    Paul

  • 01-16-2008 03:11 PM In reply to

    Re: Help! How to accomplish multiple field validation!

    This is the answer... found in a different post... by Davidair

     

    "I think I know why. When your form is running in the browser, your code (aka business logic) gets executed on the server-side when data gets sent to the server (this is also known as a postback).

    By default, Forms Server figures out by itself when to do a postback. However, this is not the case for changed events.

    To verify my claim, make a change to your dropdown then click the button. Both pieces of code will end up running.

    In order to fix this behaviour, bring up the dropdown properties, select the "Browser forms" tab and change the postback settings to "Always" instead of "Only when necessary".

    Good luck!"

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