This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
A cheap and easy workaround for this is to add a blank or informational option to the beginning of your list: <SELECT> <option value=""> <option value="update">-UPDATE- <option value="save">-SAVE- <option value="delete">-DELETE- </SELECT> or <SELECT> <option value="">Select a task: <option value="update">-UPDATE- <option value="save">-SAVE- <option value="delete">-DELETE- </SELECT> g.
Joined: Dec 11, 2002
Hi! Regarding my problem..instead of using a blank the defualt values will appear on the drop down upon loading of the page....it is required that the drop down will only contain all valid values and not a blank.... Pls feel free to ask i u need some other clarifications...:-) thanks
The problem i think is, u the page is not loaded with the default value..u are calling the same page on onChange event of the list..
i think this code will be useful <select name="" onChange=".."> <option value="s">Save</option> <option value="u">Update</option> <option value="d">Delete</option> </select> ..... //as u know the default value is Save,the remaining program can be written with value="Save"... String s = "Save"; if(request.getParameter("selectoption") != null) s = "Save"; // so in the first case, the request.getParameter("selectoption") would be null, then the value of s will be default value ie, "Save"...