Element validation

dakke

New Member
I have (to be honest) no coding experience and this question is obviously the result of it. But...

I have a drop down with a first value of 'default' having the label 'pick an option'. On submit, this should be one of the other values. Hence if value is still 'default' warn the user to choose an element.

I assume javascript, but no idea to be honest. I thought within the element (cf dropdown) and do whatever there.
What's the basic structure of such a validation?

Again I can't code from scratch (copy paste is my game), and any advice/ref/tutorial would be very much appreciated.
 
Easiest way would be instead of having the value be 'default', have it be empty, and use the 'not empty' validation rule.

-- hugh
 
That solution does not work. What I did:

1. Created 5 sub elements.
2. default value with Value Field being "" and with a label
3. other values (4) with values and labels
Applying gives the error: "please ensure all sub element values are filled in"

I can not create a sub element with a "" value, it must have something in it.
 
ok.

Just to be clear on it:
Other thread concerns checkboxes and a problem that when the user does not select on of the checkboxes, the form is nevertheless submitted (even with validation rule 'not empty').

This thread is about not being possible to add a "" in the back-end, and create a dropdown where one of the back-end values is "". This does not concern an incorrect form of the user, but is a back-end issue.
 
Yea, a new 'sub elements must be completed' error was added to Fab2.0 removing our blank option fun for dropdowns! Party Poopers! :)

I tried the:

/(^[A-z0-9]+([_\\.-][A-z0-9]+)*@([A-z0-9]+([\.-][A-z0-9]+)*)+\.[A-z]{2,}$|^0$)/

RegEx, but it wouldn't work...leaving the 0 out triggers the error message everytime, but with the 0 in there, anything clears validation.

I'm considering backing out the error message (when I find it :) ), so I can use the ol' blank options and notempty validation...was godesend. :)
 
We're going to add a new built in validation for "Not This Word", which should resolve this issue. I've beat my head against it and can't come up with a regex for that (well, not a sane one anyway), so we'll do a simple on in PHP.

-- hugh
 
Is there a national security form that prevents us from using the blanks? I think they look sooooo much cleaner than the 'Please Select' blah blah blah...when we use a dummy option for a default, I always thought it was tacky to have it show up in the dropdown list when you open it...like the blank option in the list when expanded, if that makes sense.

We may need to make some signs and picket outside of Uncle Rob's joint....'Hell, no, the warning must go! One, two, three, four, what the hell's the error for? No war for errors!"
 
We're going to add a new built in validation for "Not This Word", which should resolve this issue. I've beat my head against it and can't come up with a regex for that (well, not a sane one anyway), so we'll do a simple on in PHP.

-- hugh

Whoops, didn't see a second page with this post...would be godsend. I, too, jumped through hoops but don't know my RegEx...tried RegExBuddy and a bunch of stuff, but never got them to fire right. ;)
 
I think we decided to compromise. The reason we started not allowing blank values was because so we were getting so many support posts saying "My dropdowns don't work", only to find that they hadn't supplied any actual values, just labels.

What we might do is allow the FIRST entry in a dropdown list to be blank, but still bitch if second or susbsequent entries have no value.

Would that make you happy?

-- hugh
 
I think we decided to compromise. The reason we started not allowing blank values was because so we were getting so many support posts saying "My dropdowns don't work", only to find that they hadn't supplied any actual values, just labels.

What we might do is allow the FIRST entry in a dropdown list to be blank, but still bitch if second or susbsequent entries have no value.

Would that make you happy?

-- hugh

I'm a uniter, not a divider! ;)

Yea, I tought if I just removed the message I would have problems, as I was the one bitching about a list of blank options in the frontend table filters...so didn't want to return to that state. ;)

...though in a have-your-cake-and-eat-it-too world in which we live, I could see more value in the aforementioned validation :)
 
I'd see no harm in doing both. By allowing empty values for the first option in a dropdown list, you could do it the "old fashioned" way of just adding a "not empty" validation.

By adding an extra validation for "not this word", you'd then have the choice of which way to do it.

Anyway, we'll look at doing one or the other or both next week.

-- hugh
 
You da man. :)

Yea, the 'notempty' were nice, as you didn't have the ugly '----please select---' type of text showing up in the dropdown option list, so seemed a bit more professional to me.
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top