|
-
I'm not afraid
Hey Guys,
I really need some help. This isn't flash related but I can't figure it out for my life. I need to be able to hide sections of a form in html until a checkbox is checked. Then more form elements load.
Take a look at the example here: (it uses dropdown boxes) http://support.earthlink.net/support...rms/csform.jsp
Any help would be HUGELY appreciated.
Thanks,
Fearless
-
if you take a lot at the source of your exampla, you can see a lot of functions. It's a little hard to search the code, but there are some insigths:
-It use DHTML, so layers, dinamyc changes of styles are avaible
- Every selection in the <SELECT> tag call the selectIssue function.
This is the function
function selectIssue(passed) {
//var showNoneDetailIssueIndex = 11; // hide from browsingProblem11
//var resetDetailIssueIndex = 6; // reset from browsingProblem11
var clearIndex = 11; // reset from browsingProblem11
clearObjects(clearIndex);
id_buttons.style.display = 'none';
//showNone(showNoneDetailIssueIndex);
if (passed != 'Default') {
if (passed.length>=5 && passed.substring(0,5)=='Other') {
selectStatus(passed);
}
else {
eval('document.forms[0].'+passed+'.selectedIndex=0');
eval('id_'+passed+'.style.display=""');
}
}
/*
else { // reset objects from detail issue selections
resetObjects(resetDetailIssueIndex);
}
*/
}
At first look, you can see a parser routine, who sets styles, and call to Selectstatus and resetObjects() who is an included function, so I can't examine it.
So, dinamyc style could hide and show objects and layers, and with DHTML you have a rich interaction between user imput and writing output ... so ... some keys for thinking. If you're not familiar with Javascript and the Object Model, just forget
Good luck
Jorge
-
GRooVeZ is the name ;)
isnt there an easyer backway?
ive seen it on some sites
when you check a checkbox other radio-buttons lighten up
is this also diffucult function stuff?
-
Playing with with objects in form is more easy (writing dinamycally not)
You can acces the value of a radio button in form1 like this
document.form1.value
and check the value:
if(document.form1.value==checked) do something
Take a look at Webmonkey.com, there are some good and easy tutorials about manipulating forms
Jorge
-
I'm not afraid
Thanks for the insight guys. Really I'm not very familiar with dhtml so this was really throwing me for a loop.
would a simple if/else statement work here?
ex:
if(document.form1.value==checked)
(the html section I want to show)
else
(Continue the page without it)
Thanks,
Fearless
-
That's rigth, Javascript is the most usefull way of validate forms. About the if statement, it should work, but you need to plan your content in layers (DHTML) and use Javascript to set its visibility, referencing it by Id. If you use Dreamweaver, there's a behavior who shows you the basic.
Good luck
Jorge
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|