Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: Dynamic Forms

  1. #1
    New to the CF scene
    Join Date
    Jun 2002
    Location
    Australia
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy Dynamic Forms

    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.
    Last edited by mr_mak; 07-09-2003 at 11:37 PM.

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    1,137
    Thanks
    0
    Thanked 0 Times in 0 Posts
    what is your current code? if you post it, the code can be adpated and you can leanr were you are going wrong.

    scroots
    Spammers next time you spam me consider the implications:
    (1) that you will be persuaded by me(in a legitimate mannor)
    (2)It is worthless to you, when i have finished

  • #3
    New Coder
    Join Date
    Jul 2003
    Location
    Houston, Texas
    Posts
    58
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.


    <head>
    <SCRIPT LANGUAGE="JavaScript">
    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;
    document.formg.submit();
    return false;
    }
    </SCRIPT>

    </head>


    <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">

    </form>
    Beyond a critical point within a finite space, freedom diminishes as numbers increase. ...The human question is not how many can possibly survive within the system, but what kind of existence is possible for those who do survive."

  • #4
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    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...
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •