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 6 of 6

Thread: Input text

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

    Input text

    Hello All.

    Quick question. Is there a way to display the contents of an input Text field before submitting it to a server. If so how?

    IE: What is you name:________

    After submit you would see:

    Is this correct: Your name is___________ (inputted value)

    Any help would be appreciated. (FYI My server does not support ASP or PHP)

    Jeff

  • #2
    Regular Coder
    Join Date
    Sep 2002
    Location
    Louisiana
    Posts
    576
    Thanks
    0
    Thanked 0 Times in 0 Posts
    you could use a little javascript alert like this

    Code:
    <html>
    <head>
    </head>
    <body>
    <script type="text/javascript">
    function valid() {
    var conf = confirm("Is this your name?" + document.myForm.input0.value);
    if (conf) {
    //code to submit to server
    }
    }
    </script>
    <form name="myForm">
    <input type="text" name="input0">
    <input type="button" name="smbter" value="submit" onClick="valid()">
    </body>
    </html>
    Last edited by chrismiceli; 11-18-2002 at 11:51 PM.

  • #3
    New to the CF scene
    Join Date
    Nov 2002
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I was missleading a bit there. What you sent me works perfectly.....BUT I need to be able to select the text.

    This essentially does what I need....but I need to be able to Copy and Paste the displayed info. I asked it this way because I have had trouble phrasing what I need. Ok here goes:

    What I am trying to do is this.

    Ask a series of questions (combination of radio buttons and text fields) on a page.

    I then want to hit a button that will then insert all the data supplied into several structured paragraphs on the screen. I can then cut and paste it into my client database at work. We have very structured responses we need to give at work and they take lots of time to do. This should cut the time substantially

    I dont need the info submitted to be sent anywhere or stored anywhere. Just displayed that one time. Then I can refresh and start on the next client.

    This wouldnt be all that complex if my server supported PHP, CGI, etc....anything. But its very basic.

    any ideas? Did that make any sense at all?

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Location
    -27° 28' 22" , 153° 1' 22"
    Posts
    135
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Art Guy,

    From what you have explained it sounds like you really need to sort out the web server and get access to at least ASP. I believe that without some sort of server-side scripting you will not be able to achieve your goals.

    Question:

    Ask a series of questions (combination of radio buttons and text fields) on a page.

    I then want to hit a button that will then insert all the data supplied into several structured paragraphs on the screen. I can then cut and paste it into my client database at work...
    Once the user answers the questions on the form and the results (structured paragraphs) are then displayed on THEIR screen how would you intend to see the results, unless you were to pass the results to a database, or send via email? Or do you intend to fill out the form for them on your computer while on the telephone or something?

    Would be sooo much easier for you in the long-term to have access to use a server-side script.

    Just my thoughts anyway.
    "Computers are considered female - As soon as you make a commitment to one, you find yourself spending half your paycheck on accessories for it."

  • #5
    Regular Coder
    Join Date
    Jun 2002
    Location
    England
    Posts
    172
    Thanks
    0
    Thanked 0 Times in 0 Posts
    JustAsking - you can use JavaScript.. no need for asp. I had a script ages ago to do it but i haven't got it anymore.
    \o/

  • #6
    New to the CF scene
    Join Date
    Nov 2002
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for the advise. I know I havent been all that clear. Cant seem to word it correctly.

    I actually got a solution from someone. It uses Java. Now I am just trying to figure out how to incorporate radio buttons into this, then I'll be set.

    The code:

    <html>
    <head>
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    function displayData(form) {
    var name = form.name.value;
    var hotel = form.hotel.value;
    var add = form.add.value;
    var phone = form.phone.value;
    var adv = form.adv.value;
    var txt = 'Dear ' + name + ',\r\n\n'
    + 'Curently you have a reservation at ' + hotel + '. They are located at ' + add
    + '. They may be reached by calling ' + phone + '.\r\n\n'
    + 'Sincerily,\r\n'
    + adv + '\r\n';
    form.data.value = txt;
    }
    -->
    </script>
    </head>
    <body>
    <form>
    Name: <input type="text" name="name"><br>
    Hotel: <input type="text" name="hotel"><br>
    Address: <input type="text" name="add"><br>
    Phone: <input type="text" name="phone"><br>
    Advisor: <input type="text" name="adv"><br>
    </textarea>
    <br>
    <input type="button" value="Data" onClick="displayData(this.form)">
    <br>
    <textarea name="data" rows=12 cols=80></textarea>
    </form>
    </body>
    </html>


  •  

    Posting Permissions

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