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 2 of 2
  1. #1
    New Coder
    Join Date
    Dec 2003
    Location
    Bahamas
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Need assistance manipulating text fields

    I know this should be simple but I cant get it to work.
    1) I create a page in DreamWeaver doc type CFM (cold fusion)

    2) I have 3 text input files, a selection box and 2 button s

    3) What I want is when I click on the first button for:
    a) the 3 text fields to be concatenated into a single string
    b) the resulting string to be added to the selection list
    producing a scrollable list of all entries
    c) I also want the strings to be added to array
    d) Clear input fields for new input

    4) When I press the second button (submit)
    I want the array to be passed to the action page for processing

    Im new to both CF and JS but I have been programming for years. Need help must present this on Monday Jan 5th
    Unfortunately my script is on PC at work And I cant include it here

  • #2
    Regular Coder COBOLdinosaur's Avatar
    Join Date
    Jul 2002
    Location
    Canada
    Posts
    411
    Thanks
    2
    Thanked 32 Times in 32 Posts
    I don't get in volved with development tools. I can do better job than product that thinks it know how to generate code. So here is what it has to look like to the browser in HTML and JavaScript. How you get it to generate out of the toys i don't know.

    Like this:

    <html>
    <head>
    <title> Send Concatenated array</title>
    <script type="text/javascript">
    <!--
    var strs = new Array();
    function saveIn()
    {
    frm=document.forms['main'];
    strs[strs.length]=frm.text1.value+frm.text2.value+frm.text3.value;
    frm.thesel[frm.thesel.length] = new Option(strs[strs.length-1],strs[strs.length-1]);
    document.forms['theform'].thedata.value=strs.join();
    }
    //-->
    </script>
    </head>
    <body>
    <form name="main">
    Text 1: <input type="text" name="text1">
    Text 2: <input type="text" name="text2">
    Text 3: <input type="text" name="text3">
    <br />
    <select name="thesel" size="4"></select>
    <input type="reset" value="Save to List"
    onClick="saveIn()">
    </form>
    <br />
    <!-- form name="theform" action="yourscript.php" -->
    <form name="theform" action="JavaScript:alert(document.forms['theform'].thedata.value)">
    <input name="thedata" type="hidden">
    <input type="submit">
    </form>
    </body>
    </html>

    I sized the select at 4. If you want a different size just change that value. If you want a dropdown instead, just remove the size property. The data going across is a comma serated list. if you want to use something different than a comma, just put it as the aregument of the join. Tested with IE6 and Mozilla 1.4
    100% standards compliant code is 100% correct 100% of the time.
    one of my toys from my repository and perhaps some help getting help

    Cd&


  •  

    Posting Permissions

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