View Full Version : Dynamic form

02-25-2007, 08:22 AM
Hello all,

I would like to create a form on my internet page with a dymanic output.
The user can chose between 5 checkboxes.
Then the user has to press the submit button.
After submit the pdf files will appear corresponding to the checked checkboxes. (either underneat or with a popup)
I am not sure if this can be done in dhtml.

Thanks in advance for helping me out.

Best regards,

02-25-2007, 11:16 AM
<form action="pdf1.pdf" onsubmit="for(var i = 0, e = this.elements.files; i < e.length; ++i) if(e[i].checked) window.open(e[i].value); return false;">
<label>PDF One
<input type="checkbox" name="files" value="pdf1.pdf">
<label>PDF Two
<input type="checkbox" name="files" value="pdf2.pdf">
<label>PDF Three
<input type="checkbox" name="files" value="pdf3.pdf">
<label>PDF Four
<input type="checkbox" name="files" value="pdf4.pdf">
<label>PDF Five
<input type="checkbox" name="files" value="pdf5.pdf">
<input type="submit" value="Open">
</form>You'd be better off doing this server-side, though, or even just with normal links. Use this as a supplement to one of those two, not on its own.