SunScreenCert
asked on
ajax call with two radio buttons
Hi,
I have a field billable and i have two radio buttons yes and no. If app.getBillable value is 0, then i want the radio button yes be checked else i want no be checked. Please tell me how can i achieve this conditional checking in a servlet file.
Thanks,
I have a field billable and i have two radio buttons yes and no. If app.getBillable value is 0, then i want the radio button yes be checked else i want no be checked. Please tell me how can i achieve this conditional checking in a servlet file.
Thanks,
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
oh great..i would just try this out
ASKER
I did the same thing but it is not working
String yesChecked = "";
String noChecked = "";
String checkString = "checked = \"checked\"";
int billingModel = app.getBillingModel();
if(billingModel == 0)
yesChecked = checkString;
else
noChecked = checkString;
out.println("<tr><td>Billi
out.print("<tr><td><input type='radio' name='appStatusDescription
out.print("</td>");
out.print("<td><input type='radio' name='appStatusDescription
out.print("</td></tr>");
What is not working ?
what is printed ? What source code is sent to the browser ?
what is printed ? What source code is sent to the browser ?
ASKER
I see that none of the fields are checked when i use this code.
I don't see these fields in the source code because all of the whole table with the billing model row is coming from servlets and i have a div which it is updating, so i see only the div there like this
<div id="appresults" name="appresults">
</div>
I don't see these fields in the source code because all of the whole table with the billing model row is coming from servlets and i have a div which it is updating, so i see only the div there like this
<div id="appresults" name="appresults">
</div>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Please refer to the code below. This is a .java file. Since i have used ajax, i am using this file for the creation of table and columns.
out.println("<tr><td>Billi
out.print("<tr><td><input type='radio' name='appStatusDescription
out.print("' </td>");
out.print("<td><input type='radio' name='appStatusDescription
out.print("' </td></tr>");
Now all this is in a servlet whose response is taken by xmlhttprequest and the div of the jsp is updated. Now based on the app.getBillingModel i want that either of them should be checked. So i want all this done in this servlet file. Please tell me how do i go for it.