locked
Custom list form w/Sharepoint Designer's validation doesn't save fields if a user chooses a non-existent value for a drop-down. RRS feed

  • Question

  • I have a customized newform.aspx. I have changed some fields to text boxes to add the Sharepoint Designer built-in validation. The problem is if someone enters the wrong value on a drop-down (a drop-down that does not have any validation on it), the user gets the "Value is not among the set of valid lookup values" error, and once they correct this error and save the form, any field I've converted to a text box w/validation does not get saved.

    I tried this: http://social.msdn.microsoft.com/forums/en-US/sharepointcustomization/thread/80712782-36fd-42d2-9c12-dd54768efa87, and changed the "EnableViewState" on all my drop-downs to "false", but it still isn't saving. Any ideas?

     

     


    • Edited by Mike Walsh FIN Thursday, June 9, 2011 5:01 PM Nuts not needed
    Thursday, June 9, 2011 4:07 PM

All replies

  • Hi ,

     

    You said the field that have been changed to text box cannot get saved after a user choose a non-existent value. Please provide more information .

    1.       How do you change the field to text box? Do you achieve that by doing this in SharePoint Designer :Right click on the field and choose show common control tasks >format as ‘Text Box’ ?

    2.       What kind of validation do you add to the field ?Have you bind the validation to the correct field ?You can check this out by doing this: Right click on the validation >properties. Check out whether the value in the ’Control To Validate ’ equals to the id of the field.

    3.       What kind of drop down field do you have ? Do you create it as a look up field or some other type? What do you mean by  ‘a user choose a non-existent value’ ? The value a user chooses all exist in the drop down field .

     

    For more information ,please refer to this site:

    Adding Validation to a Custom List Control in Sharepoint: http://www.codeproject.com/KB/sharepoint/Control_validation.aspx

     

    Thanks,


    Regards, Rock Wang Microsoft Online Community Support
    Monday, June 13, 2011 11:21 AM
  • 1. Yes, I change it to a drop-down by clicking on it in Sharepoint Designer and choosing "format as textbox".

    2. I am only using two types of validation, and not all fields have both. One is the required field validator, and one is the regular expression validator. And I know they're on the right fields, and that they're set up properly b/c they all have custom error messages that appear as appropriate. (ie: if I skip the field and try to submit the form, I get a message that "X field is a required field". If I put a letter in a field that is only supposed to be digits, I get a message "X field can only contain digits".) I have no custom validation of any kind on any drop-down/lookup fields.

    3. I didn't "create" the drop-down/lookup fields on the form; they are all "List Items". The error I mentioned is a BUILT IN error message that I have no control over. When it appears ("Value is not among the set of valid lookup values") is if a user is entering data on a form, is on the field, and just types in some random value instead of clicking to see all the drop-down values and selecting one, then moves on to other fields on the form. If the user has done this, then when they submit the form, the "Value is not among the set of valid lookup values" error appears. The user would then choose the correct value and click submit, but only fields that had not been converted to text boxes would save.

     

     

    Monday, June 13, 2011 7:39 PM