kdeutsch
asked on
move items between listboxes with javascript
Wondering if anyone has some knowledge to switch items bewteen listboxes using javascript so they do not have to do postbacks for the code. her eis a smaple of what would be transfered between the 2. When Items hit listbox 2 this is when they get saved if they press submit but they want ot be able to move items between the 2 listboxes until they get it correct and then save all itmes to the db, instead of constanly having to postback moving items between the 2. Still working in Asp.net 1.1.
ID UIC
38 PUFAA
50 PUNNA
ID UIC
38 PUFAA
50 PUNNA
Hello kdeutsch
Here's what you are looking for WITH VALIDATION using an EMAIL Form's Country Select as an example...
If your Form's name is "Email"
IF your select object name is "country"
PUT THIS Javascript FUNCTION in you HEAD
==========================
<script language="javascript">
function makeChoice() {
var thevalue = document.Email.country.sel
document.Email.R_Country.v
if (thevalue == 0) {
document.Email.country.foc
alert("Please select your country.");
return false;
} else {
return true;
}
}
</script>
If your Form's name is "EmailEmail"
IF your select object name is "country"
ADD ONCHANGE to your SELECT BOX HTML
==========================
name="country" onchange="makeChoice()"
You will need a second HIDDEN field in your form to store the "currently" selected value
==========================
document.Email.R_Country.v
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Sorry forgot to accept this
not worries, Thanks for the points
Open in new window