Setting a field as mandatory for only the current view. - InfoPath Dev
in

InfoPath Dev

Setting a field as mandatory for only the current view.

Last post 06-09-2008 10:49 AM by Clay Fox. 17 replies.
Page 1 of 2 (18 items) 1 2 Next >
Sort Posts: Previous Next
  • 03-27-2008 06:42 AM

    • stuck
    • Top 150 Contributor
    • Joined on 03-26-2008
    • Posts 74

    Setting a field as mandatory for only the current view.

    Hello,Is it possible to set fields as mandatory for only the view you are working on. I am creating InfoPath 2003 forms with many different views but a lot of the fields are the same in the different views. But only the fields in the opened view should be mandatory at the time. Any ideas please?Thanks

     

  • 03-27-2008 08:25 AM In reply to

    Re: Setting a field as mandatory for only the current view.

    This is pretty common.

    You have to validate the fields yourself rather than the default method.

    Use a field to track you view and often I will use a field for each view to do validations.

    Have the validate field be true if field a is not blank, b is not blank, etc.

    Then on submit just check the validation field you need for the view they are on.

  • 03-27-2008 10:24 AM In reply to

    • stuck
    • Top 150 Contributor
    • Joined on 03-26-2008
    • Posts 74

    Re: Setting a field as mandatory for only the current view.

    Sorry I forgot to mention that I'm using InfoPath 2003 with WSS 3.0 and SQL Server 2000. So I'm publishing my forms on the SharePoint in web format.

    Is this still achievable with your method?

     Because as far I understand, when you configure rules to the submit button then it’s not possible to publish forms to the SharePoint library anymore.
  • 03-27-2008 10:31 AM In reply to

    Re: Setting a field as mandatory for only the current view.

    You can submit via rules.

    You can have as many submits as you want.

    Just set submit options to rules and then put conditions as needed and fire the various submits.

    Often you could put conditional formatting on the button and it would be disabled until the validation was right.

  • 03-28-2008 05:39 AM In reply to

    • stuck
    • Top 150 Contributor
    • Joined on 03-26-2008
    • Posts 74

    Re: Setting a field as mandatory for only the current view.

    ok so how do you use a field tro track the views. I dont understand exactly what you mean. How do you get the view names?

  • 03-28-2008 09:09 AM In reply to

    Re: Setting a field as mandatory for only the current view.

    This needs to be done manually.

    Create a field in your main Dom called View.

    Set its default to the name of your default view.

    Each time you switch a view, add an additional action which update this field to the name of the view you are sending the user to.

     

  • 03-28-2008 10:19 AM In reply to

    • stuck
    • Top 150 Contributor
    • Joined on 03-26-2008
    • Posts 74

    Re: Setting a field as mandatory for only the current view.

    is this with coding?

  • 03-28-2008 10:33 AM In reply to

    Re: Setting a field as mandatory for only the current view.

    Nope.

    You add the field to the data source.

    You are using buttons with rules and actions to switch views just add another action to set a fields value.

    If using code then again you would set the field value when executing a view switch.

     Once this is done then put rules in Open (under tools - Form options) which checks the user and the form state or last view and can open the form where it was last.

  • 03-28-2008 11:13 AM In reply to

    • stuck
    • Top 150 Contributor
    • Joined on 03-26-2008
    • Posts 74

    Re: Setting a field as mandatory for only the current view.

    hmm...Ok, I'm totally lost now :(

    Lets say I've got 2 views: 

    View1 (default) and View2

    in both of the views I have the same two fields. Age and Salary.

    so, I add a submit button for each view.

    I add an additional field to View 1 called ViewField to track the views, and set the default value to "View 1"

    I set a valudation rule on the ViewField to check that Age and Salary is NOT BLANK?

    is it right so far?now what do I do next? sorry about all these questions.

  • 03-28-2008 11:41 AM In reply to

    Re: Setting a field as mandatory for only the current view.

    Yah you are getting it.

    You would add the View field to your datasource, it would not probably be shown in the view.

    I would put conditional formatting on the submit button with conditions.

    viewfield = view1 and age is blank or viewfield = view1 and  salary is blank. Submit is disabled.

    Or you could put it as the first rule and have a warning message pop up or whatever.

     

  • 04-11-2008 09:28 AM In reply to

    • stuck
    • Top 150 Contributor
    • Joined on 03-26-2008
    • Posts 74

    Re: Setting a field as mandatory for only the current view.

    Clay Fox:

    This needs to be done manually.

    Create a field in your main Dom called View.

    Set its default to the name of your default view.

    Each time you switch a view, add an additional action which update this field to the name of the view you are sending the user to.

     

     

    "Each time you switch a view, add an additional action which update this field to the name of the view you are sending the user to."

    how is this done? I am really confused now.

  • 04-14-2008 09:15 AM In reply to

    • stuck
    • Top 150 Contributor
    • Joined on 03-26-2008
    • Posts 74

    Re: Setting a field as mandatory for only the current view.

    Anyone who can help me with this please?

    I have created a field in my DataSource and called it View and given its default value same as my default view (FormRegistration)

     I have created a submit button on each View as well.

     now this is where I get stuck....what happens next?

     

     

     

  • 04-14-2008 11:58 AM In reply to

    Re: Setting a field as mandatory for only the current view.

    now you create a conditional rule on submit

    if view = 'currentviewname' and field is not blank

    add your submit actions.

    You could have a rule which was field blank and use a message to alert the user, etc

  • 04-15-2008 06:32 AM In reply to

    • stuck
    • Top 150 Contributor
    • Joined on 03-26-2008
    • Posts 74

    Re: Setting a field as mandatory for only the current view.

    ok..I need to set the Action on my Submit buttons just to Submit as I am submitting to SharePoint so I'm not using the switch view feature.

    how can I set my View field to the name of hte current view? is there a currentview function?

     

  • 04-15-2008 08:44 AM In reply to

    Re: Setting a field as mandatory for only the current view.

    No this is all manual.

    Default the field to the name of your current view and then when switching the view with your buttons add another action to update the field with the new view name.

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