Mandatory fields only in the view your in?? - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Mandatory fields only in the view your in??

Last post 10-22-2019 12:01 PM by Ruenells. 10 replies.
Page 1 of 1 (11 items)
Sort Posts: Previous Next
  • 07-16-2007 01:32 AM

    • buzzby
    • Top 200 Contributor
    • Joined on 07-11-2005
    • United Kingdom
    • Posts 60

    Mandatory fields only in the view your in??

    Hi

     

    Is it possible to  have mandatory fields based on the current view. I have a form with 4 views. Each view is a slightly different form that required some mandatory fields. At the moment of course ALL mandatory fields must be filled in before you can save a form. Is it possible to make the form so that only the mandatory field in the view you are in need to be filled in?

     

    Thanks in advance 

    Filed under: ,
  • 07-16-2007 05:39 AM In reply to

    Re: Mandatory fields only in the view your in??

    I do not think there is a way to control the validation by view.  However you can implement validation manually.  If you have a field that you want these properties for then you can turn off the validation and use rules to perform your own validation.  With either messages when the field value changes letting the user know the correct inputs and/or on the submit putting rules that validate the values of the fields and do not submit unless they meet the requirements.
  • 08-17-2007 01:27 AM In reply to

    Re: Mandatory fields only in the view your in??

    Hello

    You can write code to delete all errors(In other views) in except current view.

    Kalyan G Reddy
    Infopath MVP 2007 and 2008
  • 08-17-2007 03:27 AM In reply to

    • buzzby
    • Top 200 Contributor
    • Joined on 07-11-2005
    • United Kingdom
    • Posts 60

    Re: Mandatory fields only in the view your in??

    Do you have a sample?

  • 08-17-2007 10:09 AM In reply to

    Re: Mandatory fields only in the view your in??

    Yes we can have fields shown as mandatory based upon the view that you are in.

    1. Add a field to your main dom.
    2. Add an onSwitchView event to your code
    3. Here set the current view to the field added in step 1 (thisXDocument.View.Name; will give you the curent view name)
    4. Now change your datavalidation to be based up on the field that is added in step 1.

     Let me know if you want more details.

  • 08-18-2007 06:27 AM In reply to

    • buzzby
    • Top 200 Contributor
    • Joined on 07-11-2005
    • United Kingdom
    • Posts 60

    Re: Mandatory fields only in the view your in??

    I'm using 2007 not 2003. Will see if the prinicible is the same but any help you can give is very helpful

  • 08-18-2007 07:22 AM In reply to

    Re: Mandatory fields only in the view your in??

    This will work with both 2003 and 2007.

  • 10-08-2007 06:08 AM In reply to

    Re: Mandatory fields only in the view your in??

    Hi

    For my two-penny's worth you can do it without code as long as you have a field value linked to each view and use that value to change the view of the form.  For example

    @View = 1 is view 1 @View = 2 is view 2 and so on.  Then set your validation on the field to also look at the value of the @View field to determine whether to switch on the validation in this view.  If you also use rules set on @View to move the views then you are guaranteed to synchronise the @View View with the correct validation.

    Cheers Adam

    Adam Harding
    Wales
    UK
  • 01-14-2008 10:31 AM In reply to

    Re: Mandatory fields only in the view your in??

    Yes, but how exactly would you set a field value to the current view name without code?

  • 01-14-2008 11:40 AM In reply to

    Re: Mandatory fields only in the view your in??

    You would create a viewstate field which defaulted to the default view name.

    Then whenever you switched the view via a rule you would also update this field with the new view name using the Set Field Value action. It takes some housekeeping but I have done this several times.

     

  • 10-22-2019 12:01 PM In reply to

    Re: Mandatory fields only in the view your in??

    I am not following how i do this and i desperately need this type of solution
Page 1 of 1 (11 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.