Dynamic combo box in html(Very Urgent)

Hi... all..

In my jsp page there is a combobox which displays all the employee id available in database and some other text boxes that fills automatically when i select a particular employee id... In the same form i have option for updating and deleting records of the selected employee..

Please help me out in solving this.. I am new to JSP..

Thanks in advance

[386 byte] By [eldho_frsa] at [2007-11-26 19:57:30]
# 1

Hello,

what do you really want to do ?

you want to delete record or field related to the current customer ?

If that's the case, you should, when updating the text box, keeping the current selected customer id maybe in session.

and then, be able to remember the selected customer when performing the others tasks.

This to just a first thought with your vague informations

Regards,

Sebastien Degardin

sdegardina at 2007-7-9 22:52:16 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

Hi..

thanks for d reply.. I ll explain.

form consists of one combo box which displays all the employee id available in database. there are three more text boxes which displays the name, department and email id of the selected employee id in the combo box. I should be able to populate these text boxes whenever i change the combobox accordingly.

When i click modify button, all the rows ie, name dept. and emailid should be updated according to the primary key employee id. which i selected in combobox.

When i click delete button, the record of employee selected in combo box should be deleted from database.

Help me out... thanks

eldho_frsa at 2007-7-9 22:52:16 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

Ok,

Solution for JSP,

Register an event on the onchange event of the combobox which send the information to the server which handle the request, get the selected id and keep a reference to the selected "employee" then the jsp get the information about the employee from the session.

and, when you click on delete button, the server proceed to delete the employee stored in session (the current employee).

Regards,

Sebastien Degardin

sdegardina at 2007-7-9 22:52:16 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
Thank u again for ur reply.. Since i am new to jsp can u give a sample code that register the event on the onchange event in combo box... and how can we distinguish whether we 've clicked the modify button or delete button?...since i've used it in the same page.....thnks
eldho_frsa at 2007-7-9 22:52:16 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5

The modify button would just redirect you to a modification from while the delete button fire a server-side action.

You should have a look at framework like Struts, JSF, Spring MVC and others .. which provide facility for MVC

<form name="form1" id="form1" method="GET">

<label>Pick a food type:

<select name="sort1" onChange="Javascript:document.form1.submit()">

<option value="Select">Select</option>

<option value="fruit">Fruit</option>

<option value="vegetable">Vegetable</option></select>

</label>

</form>

Regards,

Sebastien Degardin

sdegardina at 2007-7-9 22:52:16 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6
hi.. thank u verymuch for ur attention.... its workin...
eldho_frsa at 2007-7-9 22:52:16 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 7
Your Welcome.Happy to help.Regards,Sebastien Degardin
sdegardina at 2007-7-9 22:52:16 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 8
don't forget the Duke Stars .
sdegardina at 2007-7-9 22:52:16 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 9
Hi I want to add TWO combo box in my jsp. In first combo box I want to retrieve All the Country name from my database. And w.r.t. that selected field in 1st Combo box I want to retrieve all the STATES. where STATES are also in my database.Plz help me....Thanks
suindia at 2007-7-9 22:52:16 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 10
Hi,u also write same onchange function for first combo box and go to an action and get the states for the country.and set those values in arrayList come back to jsp .and populate the arrayList in jsp and print the value .surely u will get but the page will be refreshed...
nani_2007a at 2007-7-9 22:52:16 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 11

Hi,

I have a jsp page where I am adding/deleting/editing data dynamically.

I have a drop box which displays customer names from database. Now I want to select multiple options and when I press DELETE button I want selected items to be deleted from database.

Can you please help?it's very urgent and I am new to jsp.

My ADD function works fine it adds data dynamically but I don't how to write code for selected options from jsp page and pass that to java function delete.

I have created a servlet delete_customer. IF it's not the right way,kindly suggest me the right way.

Please help with sample code.

Thanks in Advance

-Ash

ASH_2007a at 2007-7-9 22:52:16 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...