Web Analytics Made Easy -
StatCounter Basic form handling question - CodingForum


No announcement yet.

Basic form handling question

  • Filter
  • Time
  • Show
Clear All
new posts

  • Basic form handling question

    Hi All,
    I have been teaching myself some web design usung Dreamweaver MX and I am having trouble understanding how to get a simple form handled when user hits submit button. For now, I wish to handle the form client side using Javascript, and I don't know where my error is. Here is the way I tried

    I created a from called myForm and added a simple text filed Fname ( for first name)

    I wrote a javascript function proc_myForm, that for now would simply echo the text field into an alert box.

    In dreamweaver, I set the action to proc_myForm() in the form properties window, set up the method as Post and in my javascript section I worte

    function proc_myform(myform)
    hoping I would get whatever I typed in the Fname field in an alert box.

    Needless to say, it did not work and I am not sure if it is a dreamweaver issue I do not understand, or do I have a fundemental mis-understadning of how to get and process form data in Javascript

    Any help wpuld be greatly appreciated!

    Joe Finkelstine
    [email protected]

  • #2
    When you place a variable inbetween the two parens of the function name you are either passing a value or the properties of the object that the function call took place. In your case the form. With out seeing how you constructed your form I can't tell if you are actually passing anything to the function. You might try changing your alert to this and see if it works.

    function proc_myform()


    • #3
      Hi Requestcode,
      Thanks for your reply. I originally did not post the code because I did not want to make a long message, but I still can't get any good results, so here it is

      ...first part of page not copied to save a little space on the post.....

      function proc_myform(Myform1)


      <p>Please Send us your comments</p>
      <form action="proc_myform(Myform1)" method="post" enctype="application/x-www-form-urlencoded" name="Myform1" id="Myform1">
      <table width="100%" border="1">
      <td width="11%"><label>First Name:</label> &nbsp;</td>
      <td width="20%"><input name="Fname" type="text" id="Fname"></td>
      <td width="21%">Last Name</td>
      <td width="48%"><input name="Lname" type="text" id="Lname" size="70"></td>
      <td height="91">&nbsp;</td>
      <td><input name="Submit" type="submit" value="OK"></td>
      <td><input name="Reset" type="reset" id="Reset" onClick="MM_popupMsg('akkkakkkakkk')" onMouseOver="MM_displayStatusMsg('rest button was hit');return document.MM_returnValue" value="Reset"></td>

      When I preview the page in dreamweaver - it comes back with cannot find http://locahost/sandbox/myform.html/my_proc(myform1)

      This si why I am not sure if I am using Dreamweaver worng in assigning the form action, or if I am coding something wrong here

      is there any example of a simple form with a handler that I could look at anywhere? - I have scanned the archives a bit and nothing is obvious

      Thanks for your help so far