# Miscellaneous > Database Programming >  Validator issue with dropdown fields

## alarabie

I have a dillemma, I am trying to validate dropdown fields in the update template on the right.

I understand that masks cannot be applied to dropdown fields, so how can I validate that they are entered since they only appear in the update template and not in the grid, all the information that is pertinent to the user in in blue on the left, some of the information that they have to capture is for statistical reporting and is not of importance to the every day user, hence it is not displayed in the grid. 

Those fields are mandatory and I cannot use a default, if they dont select one.
For other mandatory fields that are also dropdowns, I have used magiccells, but to display the error you have to include those fields in the grid, which is very restrictive if you don't need to show that data, and also a magiccell validates after the update, which defeats the purpose of validating input data before it is posted.

In my opinion we need to be able to validate dropdown fields before the update takes places, for my purpose, a dropdown fields eliminates the need for the user to type long descriptions, and I should still have the ability to validate that they did select one since I cannot default to one. 

I need to keep statistics on 6 different grants, and I cannot default to any one of them.

We cannot assume that every dropdown field will have a default and if they dont select one, we can default to one. 

Hope you can help on this.

PS I've attached a screen print (zip PDF) to give you an idea of what I mean.

----------


## Frank

Have you try the MagicValidate? Look at the last two sections of the Edit"

* Special server side validation parameter syntax 

and

* Example - Server MagicUpdateValidate on multiple fields 

FK

----------


## alarabie

The Example - Server MagicUpdateValidate on multiple fields 
does not show the code, only the results of the code.

----------


## Frank

here is the code -

<script language="vb" runat="server">
Sub Page_Load(Source as Object, E as EventArgs)
   Dim MU As New Tornado.Z()
      MU.dbQP = "DSN=nwind| Skin=3| Bookmark=Employees;0| startup=editupdate| TextHolder=EditTitle=Quick Edit with MagicUpdateValidate"
      MU.dbEditUpdateFlds = "(;,~)fi=0|ty=RONOUPDATE, fi=1 | oper=EQ| Comp=Kwong, fi=FirstName | oper=ST | Comp=Frank+Polly | Notes=Must be Frank or Polly, fi=3 | oper=NB, fi=HireDate | oper=RAD| Comp=1/1/80-1/1/2000| Help=edit-helpfile.htm;350;250;200;200"
      MU.ASPdbNET()
End Sub
</script>

----------


## alarabie

The + between Frank and Polly should be a ~ to work.

Thanks for the example.

----------


## alarabie

In the example, I presume that having an operator of NB on the title field means that it cannot be blank, this does not seem to work, I can update the record with blanks in the title.

----------


## Frank

Correct, it need a dummy field to get into the filter like ->

fi=3 | oper=NB| Comp=Dummy

I'll correct that and get rid of that 'Dummy'. V02.24+ will have the fix. 

FK

----------


## alarabie

I've tried and cannot get Magic update to work with dropdowns fields, I've set a value of "na" in the table to test and added this code
.dbEditUpdateFlds  "fi=1,fi=10,fi=11|,fi=2|ty=selectbox|val=MCCID|tex  =MCCID|oper=EQ|comp=na,fi=3" 
and regarless of what selection I use it will always give me the magic validate error. Adding the same code on a non dropdown field works fine.

I'm getting real frustated with dropdown fields and not being able to validate the user choice. It seems to me that using selectbox+b and then validating that the user made a choice(ie field is mandatory and blank is not acceptable) would be a very basic edit required on update and add functions.

Why is that not supported, a dropdown field is just another text field?

----------


## Frank

Correct - this mystery is solved. The drop fields are not registered in MagicValidate correctly - fixed.

FK

----------


## alarabie

Thank You, Thank You, Thank you.

When are you planning the next release? I have a few issues that have been fixed that i need to put in production.

----------


## Frank

I'll finish checking up the ted F7 problem and I'll send you the non-official release for you to check out. I appreciate that you are the one user that drills on the data validation with great depth. Like this little typo causing the MagicValidate DropDown to fail was not reported. When you are done then the validation should be solid !!!

FK

----------


## alarabie

You're welcome.

Just send it anytime.

----------

