Can someone show me how to do this? I have used a checkbox to show certain data if the box is checked and if the box isn't checked, it doesn't show the data. My only problem with that is this: the checkbox as a submit function that posts back to itself on the same page. I don't want to do that. I don't want the page to refresh because I don't want to lose the data if the user has typed anything in the form.
Something like what I'm trying to do is:
1. Have a form on an ASP page with 3 sections
Section A - Table with fields for Personal Information
Section B - Table with fields for Contact Information
Section C - Table with fields for Company Information
2. Before Section C I would like a Radio Group with 2 Options "Yes" and "No". If the user would like to register as a company they would click "Yes".
3. When the user clicks "Yes", the fields in Section C will no longer be greyed out and the user will be able to fill them in.
Much thanks to you guys!
How do I show specific data in a form on ASP page if Radio Button has value of "checked" ?
I'd use javascript and html
%26lt;body%26gt;
%26lt;div id='SectionA'%26gt;
personal information table goes here
%26lt;/div%26gt;
%26lt;div id='SectionB'%26gt;
contact information table goes here
%26lt;/div%26gt;
%26lt;input type='checkbox' id='chkCompany'
onclick='javascript:togglecompany(this...
text='Register as company'%26gt;
%26lt;div id='SectionC' style='visibility:hidden;'%26gt;
company information table goes here
%26lt;/div%26gt;
%26lt;/body%26gt;
%26lt;script language='javascript'%26gt;
function togglecompany(thecheckbox){
if(thecheckbox.value==true){
document.getElementById
('SectionC').
style.visibility='visible';
//the above 3 lines should be 1
}
else{
document.getElementById
('SectionC').
style.visibility='hidden';
//the above 3 lines should be 1
}
}
%26lt;/script%26gt;
if the user checks "register as company"
then the company information appears,
otherwise it remains hidden.
no postback involved
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment