SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    ********* Scotland Saltire's Avatar
    Join Date
    Jan 2000
    Location
    Scotland
    Posts
    660
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Form Results using Javascript

    Hi,

    I have a form which we are going to use at work to allow staff to enter data on a users problem and then click submit and it will automatically generate a copy and pastable completed form which they can then put into our logging system.

    Current Form:

    Q: FORM FIELD

    When the user clicks submit, (we don't have CGI etc) I need to be able to use javascript to get the current form field data and display it on the page.

    Anyone who can help, please do! It would be much appreciated!

    I basically need to be able to do the equivalent of a PHP ECHO of the data in the form fields.

  2. #2
    Rehab is for quiters! spartan's Avatar
    Join Date
    Apr 2002
    Location
    Cape Town, South Africa
    Posts
    343
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    does the page get submitted or do you just want to do this client side, on click, without submitting the page?
    Spartan
    ---------------------
    It's like our sergeant told us before one trip into the jungle. Men! Fifty of you are leaving on a mission. Twenty-five of you ain't coming back.
    -Mr.Payne

  3. #3
    ********* Scotland Saltire's Avatar
    Join Date
    Jan 2000
    Location
    Scotland
    Posts
    660
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK, have got somewhere.

    Client side. Must validate and popup results in a new window.

    Can get the validation to work, but not get it to popup the window. Code below.

    }
    return true;
    }
    if (validate==true) {
    DispWin = window.open('','NewWin', 'toolbar=no,status=no,width=600,height=400')
    message = "<font face=Verdana, Arial, Helvetica, sans-serif size=2><b>Agent Name: </b>" + document.pandgform.agent_details.value;
    message += "<br><b>BA Telephone Number: </b>" + document.pandgform.bb_tel_no.value + "</font>";
    DispWin.document.write(message);}
    else
    {
    return validate();
    }
    // -->

  4. #4
    ********* Scotland Saltire's Avatar
    Join Date
    Jan 2000
    Location
    Scotland
    Posts
    660
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <script language="Javascript">
    function validate(){
    if((agentdetails == ''))
    {
    alert("sucks");
    }
    else
    {
    check();
    }
    }
    function check(){
    //Declare Variables
    if((agentdetails==true))
    {
    window.document.location.href = "index_return.htm";
    }
    else
    {
    window.document.location.href="x/x.htm";
    }

    }

    </script>

    Any ideas why this isn't working?

  5. #5
    Rehab is for quiters! spartan's Avatar
    Join Date
    Apr 2002
    Location
    Cape Town, South Africa
    Posts
    343
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it seems to work just fine.
    are you getting any error mesages?
    Spartan
    ---------------------
    It's like our sergeant told us before one trip into the jungle. Men! Fifty of you are leaving on a mission. Twenty-five of you ain't coming back.
    -Mr.Payne


Bookmarks

Posting Permissions

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