Hi, I have a page with several textboxes and comboboxes which all seem to work fine. The issue I have is with one textbox tb_Service and a combobox cmb_Service. What I have is tb_Service is a readonly textbox with a button (but_Modify). When the button is clicked a div is made visible revealing cmb_Services and two buttons to add or delete services. So when the user clicks modify, they select a service from the combobox and click add or delete buttons. These buttons have clientside java which will add or delete the service from tb_Services.
The code for the add is...
The code for deleting is similar and both codes work fine. In a test I added two sevices and ended up with tb_Services displaying SERVICE A; SERVICE B
I have another button which does a save. This is done in the code behind. When I look at what tb_Services.Text equates to at a breakpoint it is an empty string which is its value when the page was first populated. If I go to a record which already has a Service and add another the textbox displays correctly but once again when I click the save button and check the value of tb_Services is only has the original service and not the one I added. What am I doing wrong?
The code for the add is...
function butServiceAddClick() { var ServiceSelected = $('#cmbx_Service').val().toUpperCase(); if (ServiceSelected == "PLEASE SELECT...") { //No Service selected so do nothing and exit return true; } else { var tb = $('#tb_Services'); var oldvalue = tb.val().toUpperCase(); var ServiceList = oldvalue + ";"; if (/ServiceSelected + ";"/i.test(ServiceList)) { //The selected Service is already in the list //Do nothing and exit return true; } else { var newtext = ""; if (ServiceList == ";") { newtext = ServiceSelected; } else { newtext = ServiceList + " " + ServiceSelected; } tb.val(newtext); registerChange(tb, oldvalue, newtext); } } }The code for deleting is similar and both codes work fine. In a test I added two sevices and ended up with tb_Services displaying SERVICE A; SERVICE B
I have another button which does a save. This is done in the code behind. When I look at what tb_Services.Text equates to at a breakpoint it is an empty string which is its value when the page was first populated. If I go to a record which already has a Service and add another the textbox displays correctly but once again when I click the save button and check the value of tb_Services is only has the original service and not the one I added. What am I doing wrong?