'Cannot be blank' fields on other views - InfoPath Dev
in

InfoPath Dev

'Cannot be blank' fields on other views

Last post 10-13-2005 02:07 AM by DavidCrabbe. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 10-12-2005 08:47 PM

    'Cannot be blank' fields on other views

    I'm designing a form that has a 'request' view and an 'approval' view. Users enter the details of their request using the request view, submit it, and their manager then opens form in the approval view to indicate if the request is approved or rejected. The approval view is not accessible from the View menu when the user completes the form.

    I would like the approval view to contain a 'cannot be blank' field called Approved which stores the approved/rejected status. Currently this defaults to the 'Select...' (blank) option in a droplist, with 'Yes' (true) and 'No' (false) as the other two possible values.

    However when the user making the request submits the form they receive an error stating: "This form contains validation errors that are not in the current view" - obviously due to the Approved field on the approval view.

    I'd really rather force the manager on the approval view to actually make a choice, hence setting the default value to 'Select...' (blank) rather than a valid value of 'Yes' or 'No'.

    Is there anyway to retain the standard InfoPath 'Cannot be blank' functionality, e.g. validiation checking and the little red star, and yet also have mandatory fields on other views as I've described?

    This could be a stupid question as I'm new to InfoPath development but I'd really appreciate a few pointers as to the best practice for this kind of thing.

    Thanks,
    David.
  • 10-13-2005 12:24 AM In reply to

    Re: 'Cannot be blank' fields on other views

    Hi,

    Depends on one things:

    with my method: If this date is an element(node) you can if it's an attrribute you can't!

    My method (the date field is an element):
    You can use nillable="true". Modify your schema and add the possibility to make nillable your field and choose true for default value.

    Now when the user fill out the form he can validate. And when the approval person open the form make a custom code (managed or script code) for delete this attribute (make a search on this forum there are an explanation about how to make that) and now the approval person has to give a date else he has a validation error!

    hope this help!

    ++

    Thierry



    Every moment hesitated is a moment gone for life!!! Think about it
    Infopath 2007, Langage: C#2.0 (Modèle Objet 2003)
    merci de lire ceci
  • 10-13-2005 12:53 AM In reply to

    Re: 'Cannot be blank' fields on other views

    Hi,

    An alternative (and I think that there are several ways to tackle this), is to do the entire validation by code.
    If you put a default value in your drop down (value: NA / display: ""), the form will not complain about blank field as it will never be blank. Now, the trick is to do the validation by code, and to prevent users from submitting, switch view if the content of the node linked to your drop-down carries the value NA.

    Franck Dauché
  • 10-13-2005 02:07 AM In reply to

    Re: 'Cannot be blank' fields on other views

    Thanks for the suggestions, it's very useful to get a different perspective.

    I think what I'll probably do is use two buttons, Approve & Reject, which set the Approved field to the desired value.

    Seriously though, is it not possible to have a 'cannot be blank' field on a view which is not part of the original submission? Or is some kind of workaround the only solution?
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.