I have editable dropdown list box on jquery grid, if I am not selecting the dropdown list box item I need to give a messagebox to the user saying please select..
How do I do this using jquery?
I have editable dropdown list box on jquery grid, if I am not selecting the dropdown list box item I need to give a messagebox to the user saying please select..
How do I do this using jquery?
Do you mean a standard
alert("Your message goes here");
? Or perhaps a
if (confirm("Your question)) {
// do things if OK
}
?
These aren't actually jQuery, but browser JavaScript. Maybe a less intrusive method could be used ( Like How to generate a simple popup using jQuery for example.)
jQuery is a lot of fun, I hope this is what you needed!
Ok, I think I get what you mean, but I'm not sure you really need to do what you're suggesting!
A select menu will always have something selected, usually the first option by default. Also, you can only give the user some sort of prompt once they have tried to submit the form otherwise you'd get an alert everytime the page loaded - not very user friendly. Does that make sense?
The easiest way to make sure your users select something manually is to give the first option in the list a value of something like "Please choose..." and then every subsequent option a value which is valid for whatever it is they are selecting. That way, when the user submits the form (this can be done automatically when a new option is selected if you wish) you simply need a quick check to see that the value selected isn't "Please choose...". If it is, then give them some sort of alert - either a popup (yuk!) or do it with some nice, styled, html.
I've never used the jqGrid plugin, but I hope the above helps you to figure it out!