Results 1 to 5 of 5
Thread: Help with validating a string
- 03-14-2013, 09:41 AM #1
Member
- Join Date
- Mar 2013
- Posts
- 3
- Rep Power
- 0
Help with validating a string
Guys.
My first java post, and my first attempt at trying to modify a java script.
I have a small script that i'm trying to modify (below)
This was originally to check if a field was empty or not, however, I'd like to modify it so it checks the
existance of a specific string.
I've played with the X== section, but i've now conceded that it's not as easy as i thought it would be.
Ideally, i just want to create a challenge question, and the script will check if the answer is correct.
Could anyone point me in the right direction please.
<script>
function validateForm()
{
var x=document.forms["myForm"]["answer"].value;
if (x==null || x=="")
{
alert("Answer must be filled out");
return false;
}
}
</script>
</head>
<body>
<form name="myForm" action="demo_form.asp" onsubmit="return validateForm()" method="post">
Answer: <input type="text" name="answer">
<input type="submit" value="Submit">
</form>
- 03-14-2013, 09:51 AM #2
Re: Help with validating a string
Java != javascript! Go and find a javascript forum.
Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
The Ubiquitous Newbie Tips
- 03-14-2013, 09:52 AM #3
Member
- Join Date
- Mar 2013
- Posts
- 3
- Rep Power
- 0
Re: Help with validating a string
LOl.. shows what I know
-
Re: Help with validating a string
Try this javascript forum: JavaScript frameworks - CodingForums.com
Or learn JAVA - not javascript / html
- 03-14-2013, 10:06 AM #5
Member
- Join Date
- Mar 2013
- Posts
- 3
- Rep Power
- 0
Similar Threads
-
Validating log in using database
By mDennis10 in forum New To JavaReplies: 6Last Post: 03-11-2012, 12:17 AM -
Validating a string, containing either numbers or letters
By MaceMan in forum New To JavaReplies: 2Last Post: 11-30-2011, 04:41 PM -
Validating Jtable
By anilkumar_vist in forum Advanced JavaReplies: 1Last Post: 11-24-2009, 02:54 PM -
Validating for length of String
By Bascotie in forum New To JavaReplies: 1Last Post: 10-11-2009, 11:45 AM -
validating a string for numbers and letters?
By lockmac in forum New To JavaReplies: 1Last Post: 08-09-2007, 09:17 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks