36 users online (0 members and 36 guests)  


  Results 1 to 3 of 3

Related

  1. required fields in a form    Forum: HTML Forum
    Replies: 17
  2. Mandatory fields form    Forum: HTML Forum
    Replies: 0
  3. Required Form Fields    Forum: Javascript Forum
    Replies: 1
  4. Replies: 1
  5. Dynamic form fields    Forum: Website Scripts Forum
    Replies: 1
  1. #1
    frosty0457's Avatar
    New User

    Status
    Offline
    Join Date
    Apr 2004
    Posts
    2

    Unhappy Adding form fields

    I need to write a perl script that will add form fields to itself. For example, a user clicks on an add button and a label and textfield is added to the end of the page. Also, all of the forms previously on the page should retain thier information entered. Any help to get me started will be greatly appreciated.

  2. #2
    frosty0457's Avatar
    New User

    Status
    Offline
    Join Date
    Apr 2004
    Posts
    2
    Ok, I found this script online. It is in javascript. Can someone convert this into perl? I need it to retain info that has been entered.

    Oh, I've modified it a little from the original script.


    <HEAD>

    <SCRIPT LANGUAGE="JavaScript">
    <!-- Original: Peter Hermus -->
    <!-- Web Site: http://come.to/speedpete -->

    <!-- This script and many more are available free online at -->
    <!-- The JavaScript Source!! http://javascript.internet.com -->

    <!-- Begin
    var ctr=1;
    data = "";
    function createForm() {

    inter = "'";
    spaces=" ";

    data += "Year " + ctr + " :" + spaces
    + "Grants "+" <input type='text' size=10 name=" + inter + "finaid_grants" + ctr + inter + "'>"
    + "Scholarships "+"<input type='text' size=10 name=" + inter + "finaid_schols" + ctr + inter + "'>"
    + "Loans "+" <input type='text' size=10 name=" + inter + "finaid_loans" + ctr + inter + "'>"+"<br>";
    ++ctr;
    if (document.layers) {
    document.layers.cust.document.write(data);
    document.layers.cust.document.close();
    }
    else {
    if (document.all) {
    cust.innerHTML = data;
    }
    }

    }
    // End -->
    </script>
    </HEAD>

    <BODY>

    <center>
    <form name="counter" method="post" action="processWebForm.pl">
    <input type=button value="Add" onClick="createForm();">
    </form>

    <br>

    <form name="webform" method="post" action="processWebForm.pl">
    <table border=0>
    <input type=hidden name='data_count'>
    <tr><td colspan=2>

    <!-- Placeholder for dynamic form contents -->
    <span id=cust style="position:relative;"></span>

    </td>
    </tr>

    <tr>
    <td></td>
    <td><input type=submit value="Send"></td>
    </tr>
    </table>
    </form>
    </center>



  3. #3
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Javascript is client-side, perl is server-side. So chalk & cheese, they are unalike. 'converting' is not really feasible.

    However, you could retain the information using sessions. How to implement that in Perl, I do not know. Hopefully one of our Perl users will pipe up.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?



Tags for this Thread