[jQuery] copying from one select box or combobox to another.
I know I've already asked this before -- and, well, it may not even be
possible, but, here goes again. Is it possible to copy from one
combobox to another one; such as address information. After COMBING
the web, I FINALLY found an example here:
http://www.plus2net.com/javascript_tutorial/copy-listbox.php
But, what I would like to do is use telerik's radcombobox or an
asp.net combobox to do mine with. Below, you can see where I got it to
work using just a plain old HTML select box, but I really want to get
it to work using telerik's combo; as they have cool styling and
functionality on theirs.
Here's my radiobuttonlist control:
<asp:RadioButtonList ID="rblMailingAddress" runat="server"
TabIndex="330">
<asp:ListItem Value="SameasBusaddr">Same as my business
address.</asp:ListItem>
<asp:ListItem Value="SameasHomeaddr">Same as my home
address.</asp:ListItem>
<asp:ListItem Value="Separateaddr">This is a separate
address.</asp:ListItem>
</asp:RadioButtonList>
Here's my RadcomboBoxes:
<radC:RadComboBox ID="cmbBusinessState" runat="server"
DataSourceID="StateListXmlDataSource"
SkinsPath="~/RadControls/ComboBox/Skins"
Width="140px" TabIndex="160" DataTextField="Text"
DataValueField="Value" Height="140px"
Skin="WindowsXP" MarkFirstMatch="True">
</radC:RadComboBox>
2 more with an ID of cmbResidentState and cmbMailingState
And here's my jquery:
$(document).ready(function(){
//For Mailing Address information
$('#rblMailingAddress :radio').click(function() {
var CurVal = $("input[@name='rblMailingAddress']:checked").val()
if(CurVal == "SameasBusaddr")
{
$("#tbMailingAddress").val($("#tbBusinessAddress").val()); //these 2
peterblum textboxes are working fine.
$("#tbMailingCity").val($("#tbBusinessCity").val()); //so are these,
they are working too.
$('#Select2').val($('#Select1').val()); //this worked with just plain
old html select boxes.
$("#msdeMailingZip").val($("#msdeBusinessZip").val()); //Peter Blum's
Multi-Segment Data Entry is not working either but I will contact him
for that issue.
}
else if(CurVal == "SameasHomeaddr")
{
$("#tbMailingAddress").val($("#tbResidentAddress").val());
$("#tbMailingCity").val($("#tbResidentCity").val());
$("#cmbMailingState").val($("#cmbResidentState").val()); //tried
telerik.com's radcombobox but this didn't work.
$("#msdeMailingZip").val($("#msdeResidentZip").val());
}
else
{
//If "This is a separate address." was clicked then clear 'em out and
reset the comboboxes to 0 SelectedIndex.
$("#tbMailingAddress").val("");
$("#tbMailingCity").val("");
$("#Select1").selectedIndex = 0; //This is not working either but
I'll figure this part out later.
$("#msdeMailingZip").val("");
}
}); //end click for Mailing Address info
}); //end main function
If ANYONE could help me I would appreciate it SOOO MUCH! This is
driving me nuts. :-P
p.s. Using Visual Studio 2005 with ASP.Net 2 dot 0
thanks, milli