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 11 of 11
  1. #1
    New to the CF scene
    Join Date
    Jan 2004
    Location
    Australia
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Another newbie... cross browser forms

    Having my first go at forms, being a MacOSX user on Dreamweaver MX, was checking thru Safari and all my validation coding was working fine. Then when I checked in Explorer and Navigator, validation was seen to be not working. Is there an easy answer? Have I missed something?
    Regards all

  • #2
    New to the CF scene
    Join Date
    Jan 2004
    Location
    Australia
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    oops

    Forgot to add my url
    http://pidezyn.com/football/round00.html
    This is just a test page

  • #3
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    You have two form tags:

    <form action="http://www." method="POST">
    <form name="formcheck" onsubmit="return formCheck(this);">
    ...
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #4
    New to the CF scene
    Join Date
    Jan 2004
    Location
    Australia
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Glenn
    Thank you for your reply.
    I am assuming that I only have to remove the second "<form" and leave it as "name="formcheck"..."
    Will work on that when I am back at the office.
    Regards

  • #5
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    Remove the first form tag.

    <form action="http://www." method="POST">
    <form name="formcheck" onsubmit="return formCheck(this);">
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #6
    New to the CF scene
    Join Date
    Jan 2004
    Location
    Australia
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks Glenn
    But when I finally want to enter URL for "form action...POST' how? Or should it go elsewhere?

  • #7
    New to the CF scene
    Join Date
    Jan 2004
    Location
    Australia
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Having removed the rogue line, now works in Navigator as well as Safari, but still not in Explorer (just get a new clean page of the same).
    Also referring back to previous post re form action to cgi-bin.
    I'm almost there... I think. Thanks guys in advance.

  • #8
    New Coder
    Join Date
    Jul 2002
    Location
    Los Angeles
    Posts
    89
    Thanks
    0
    Thanked 0 Times in 0 Posts
    <form action="YOUR URL HERE" name="formcheck" onsubmit="return formCheck(this);" method="POST">

    ----
    Moved the action and method into one form tag.

  • #9
    New to the CF scene
    Join Date
    Jan 2004
    Location
    Australia
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Great Oakendin thanks.

    Still not solving my problem why the validation doesn't work in Explorer, if anyone can see why.

  • #10
    Regular Coder
    Join Date
    Apr 2003
    Location
    Atlanta, GA
    Posts
    487
    Thanks
    0
    Thanked 0 Times in 0 Posts
    To where are you posting? You have to change the form tag given you by Oakendin to the URL of your processing page. Also, regardless of whether the values are all valid, your script seems to be returning false.

    Also: formElement.type *is* defined for radios and checkboxes, and should be definite cases in your switch statement. The validation you've got in your case "text" and "textarea" won't fly, should I happen to type two spaces into the field - an invalid response. Use a trim function like these:
    Code:
    String.prototype.lTrim = function () {
    	var whitespace = new RegExp("^\\s+","gm");
    	return this.replace(whitespace, "");
    }
    
    String.prototype.rTrim = function () {
    	var whitespace = new RegExp("\\s+$","gm");
    	return this.replace(whitespace, "");
    }
    
    String.prototype.trim = function () {
    	return this.rTrim().lTrim();
    }
    or this:
    Code:
    function Trim(str) {
        return str.replace(/^\s+/gm).replace(/\s+$/gm);
    }
    I'm sure this latter option can be combined into a better algorithm, but the above set of prototype options works best for me.


    All that being said, it works just the same in IE6w as it does in Opera7w; it's long been known that IE5m is (while a great rendering engine and a pioneer in CSS) one of the buggiest browsers around. I'd be surprised to find out that it has a greater market share than any other Mac browser.

  • #11
    New to the CF scene
    Join Date
    Jan 2004
    Location
    Australia
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you Choopernickel
    At least now having a URL has made some difference even if it is not absolute at the moment.

    Where exactly should that code you posted be placed?

    Don't know if it was another problem, but I did have:

    if (alertMsg.length == l_Msg){
    alert("Your tips have been submitted")
    return false;
    }else{
    alert(alertMsg);
    return false;

    so I changed the first false to true... OK?

    One day I wil understand all of this a lot better (Approaching my 60's and learning is slow)

    Appreciate this help!


  •  

    Posting Permissions

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