mandatory fields - InfoPath Dev
in

InfoPath Dev

mandatory fields

Last post 10-23-2008 07:32 AM by chandrakanth. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 10-23-2008 03:22 AM

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

    mandatory fields

    Hello,

    Something strange has happened to my InfoPath 2007 forms. Previously I used to be able to set the "Cannot Be Blank" option for my controls independently in different views.

    So for example I could set the field in Field1 in View1 as mandatory, but in View2 i could set the same field (Field1) as NOT mandatory.

    However now it seems work globally, so whenever I set a Field1 in View1 as mandatory it seems to apply this for all the Field1's in all my views.

    Is there any way to stop this?

    Help would be much appreciated.Thanks

     

  • 10-23-2008 04:00 AM In reply to

    Please follow the steps for implementing your functionality.

    ·         Add a new field (let it be named as currentViewName) into the main schema.

    ·         Set the present form view name into the "currentViewName" field. This can be done by writing the below code in the "OnSwitchView" event.

    thisXDocument.DOM.selectSingleNode("/my: myFields /my:currentViewName").text = thisXDocument.View.Name;

    ·         Now add a "Data Validation" for the “field1” field. So that if currentViewName is equal to the viewname in which you want to show the “field1” field mandatory ,then set the Screen Tip "Cannot Be Blank".

    I hope the above steps will help you.

    Chandrakanth/GGKTech
  • 10-23-2008 04:09 AM In reply to

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

    thanks that is something that I might be able to do in the future.

    but at the moment i need to have my previous settings back as I only want to set mandatory fileds for my default view.

  • 10-23-2008 06:17 AM In reply to

    I don't believe what you describe exists.  Fields are specified as "cannot be blank" within the data source, not within the individual views.

    However, there are things you can do to enforce that fields are filled in for certain views of the form.  If you leave "Cannot be blank" unset for field1 in your example, you can use conditional formatting to hide certain other controls (buttons, etc.) in the view whenever field1 is blank so that users have to fill in the field in order to finish using the form for whatever its purpose is.  Alternatively if the view has a submit button or something like it, you can add rules so that the button shows an error message when field1 is blank, and does not proceed with submitting the form.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 10-23-2008 06:43 AM In reply to

    • Bhavesh
    • Top 500 Contributor
      Male
    • Joined on 05-01-2008
    • Atlanta
    • Posts 40

    Hi,

    what i understood is that you have a field in the data source and you are creating multiple instance of that field on different views. When u create instance of same field on different view, the field validation will be applied globally that is what ever field validation you had kept on the field in the data source will be applicable to all it's instace on diferent view.

    hope this will help you

    Bhavesh

  • 10-23-2008 07:32 AM In reply to

    Hi,

    As per my knowledge on Infopath if the "Cannot be blank" check box is checked for a field in data source, it is not possible to make the field mandatary in one view and not mandatory in different view. So if a field set mandatory in datasource it is globally set in all the views.

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