View Full Version : Dynamic Forms

07-09-2003, 11:23 PM
I am having difficulty writing a JS which creates a dynamic
form containing all the combined input parameters of all forms
existing in a page. The purpose of such a form is to make all parameters on the page available to a common server side routine that is actioned when submit is called on the dynamic form.

Haven't written any code yet as I'm not sure how to approach such a problem.
Any help will be appreciated.

07-09-2003, 11:29 PM
what is your current code? if you post it, the code can be adpated and you can leanr were you are going wrong.


07-11-2003, 06:55 AM
I hope this will help you. I have a page with 6 forms on it
and I submit them all with one button using the following script
I have included part of my HTML code that shows six forms
where I enter data and the seventh form combines all of them
and is submitted. Please note where I placed the submit button.
the seventh form contains all hidden inputs with all the
fields that are on the other six forms.

Hope this is what you need.

function copydata()
document.formg.text_one.value = document.forma.text_one.value;
document.formg.a_type.value = document.forma.a_type.value;
document.formg.rq_name.value = document.forma.rq_name.value;
document.formg.fl_name.value = document.forma.fl_name.value;
document.formg.emp_stat.value = document.forma.emp_stat.value;
document.formg.emp_id.value = document.forma.emp_id.value;
document.formg.bus_unit.value = document.forma.bus_unit.value;
document.formg.dpt.value = document.forma.dpt.value;
document.formg.brfr.value = document.forma.brfr.value;
document.formg.tt.value = document.forma.tt.value;
document.formg.text_two.value = document.formb.text_two.value;
document.formg.text_three.value = document.formc.text_three.value;
document.formg.text_four.value = document.formd.text_four.value;
document.formg.text_five.value = document.forme.text_five.value;
document.formg.text_six.value = document.formf.text_six.value;
document.formg.oa_0.value = document.formf.oa_0.value;
return false;


<form name='forma' onSubmit='return copydata()'>
<form name='formb' onSubmit='return copydata()'>
<form name='formc' onSubmit='return copydata()'>
<form name='formd' onSubmit='return copydata()'>
<form name='forme' onSubmit='return copydata()'>
<form name='formf' onSubmit='return copydata()'>
<input type='submit'>

<form name="formg" action="yourpage.php" method="post">
<input type="hidden" name="text_one">
<input type="hidden" name="text_two">
<input type="hidden" name="text_three">
<input type="hidden" name="text_four">
<input type="hidden" name="text_five">
<input type="hidden" name="text_six">
<input type="hidden" name="a_type">
<input type="hidden" name="rq_name">
<input type="hidden" name="fl_name">
<input type="hidden" name="emp_stat">
<input type="hidden" name="emp_id">
<input type="hidden" name="bus_unit">
<input type="hidden" name="dpt">
<input type="hidden" name="brfr">
<input type="hidden" name="tt">
<input type="hidden" name="oa_0">


07-11-2003, 09:33 AM
After a quick wiew... I wonder... Why not using a single form?... You may send the all values to the JavaScript function within a single button and use return false and return true to verify values and send them to the CGI when all correct...