www.webdeveloper.com
Results 1 to 4 of 4

Thread: Need help with validation - noob!

  1. #1
    Join Date
    Jun 2012
    Posts
    4

    Need help with validation - noob!

    Hi guys, I'm new to PHP and I'm trying to sort out a site at work.
    We have a form that users fill in, I'm wanting it to bring up a message if the following criteria are met
    "temp1" on the form has "Shape Creation Request" selected (this is the value of an option) AND the length of "temp11" is under 22 characters

    at the moment I have the following that doesn't work:

    Code:
    if(document.all.temp1.str=="Shape Creation Request" and document.all.temp11.value.length <22)
    {
    	alert("Please provide the full publication code including edition.");
    	return false;
    }
    an example of one of the alerts we have that does work is:
    Code:
    if(document.all.temp2.value.length <6)
    {
    	alert("Please provide the full name of the person making the request, whether this is yourself or another user.");
    	return false;
    }
    any help would be greatly appreciated as I need to replicate this for some other fields too

  2. #2
    Join Date
    Jun 2012
    Posts
    9
    This belongs in PHP...
    Wait, you mean Javascript?

  3. #3
    Join Date
    Jun 2012
    Posts
    4
    Quote Originally Posted by Likegames View Post
    This belongs in PHP...
    Wait, you mean Javascript?
    ???
    yes, I mean javascript, within a php page

    sorted now anyway

    replaced "str" with "value" and "and" with "&&"

  4. #4
    Join Date
    May 2006
    Location
    Somewhere behind your screen
    Posts
    1,648
    does document.fail look much cooler than document.all?
    xxx: Guess Buddhist riddle: "What is the sound of one hand clapping?"
    yyy: facepalm

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles