0

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?

Shayki Abramczyk
  • 36,824
  • 16
  • 89
  • 114
kumar
  • 2,944
  • 18
  • 60
  • 89
  • Could you explain this a bit more and provide whatever code you already have? I'm not exactly sure what you're trying to achieve! – musoNic80 Apr 12 '10 at 17:39
  • Ok thanks,, I have jquery grid with editable coulumn with editype has select. like dropdown list box.. if use not selected dropdown list box or he is not going to edit anythign in that row.. I should display a mesage box with please select the value from dropdwon list? thanks please let me know if you dint got again? thanks – kumar Apr 12 '10 at 17:50

2 Answers2

0

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!

Community
  • 1
  • 1
Kyle Hotchkiss
  • 10,754
  • 20
  • 56
  • 82
0

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!

musoNic80
  • 3,678
  • 9
  • 40
  • 48