SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
Thread: Validate Hidden Field
-
Mar 8, 2004, 11:28 #1
- Join Date
- Sep 2003
- Location
- Cleveland, TN
- Posts
- 25
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Validate Hidden Field
Hi all,
Have a page that will display a list of subject lines if there are any defined. I also have a next button that acts as a submit button. I am trying to check to make sure a user has defined at least one subject line before moving on. The issue I am having is checking for the subjectkey which is a hidden field.
Any ideas?
Here is the JS I am trying to use:
function doSubmit(){
var f = document.forms[0];
if (f.Subject.value == ''){
alert('You must provide at least one subject line.');
return false;
}
//submit the form
f.submit();
}
Subject is the hidden field. I am using coldfusion and looping over a query to check for the subjectkey.
Thanks in advance,
GuyIntn
-
Mar 10, 2004, 03:36 #2
- Join Date
- May 2002
- Location
- Vancouver, BC
- Posts
- 459
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Heya,
That code actually works fine for me on IE6. Is there something else in your page, perhaps, that's getting in the way?
-
Mar 10, 2004, 11:28 #3
- Join Date
- Sep 2003
- Location
- Cleveland, TN
- Posts
- 25
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I actually got it to work. Below is the complete function.
function doSubmit(){
var f = document.forms[0];
if ((#getSubjectLines.RecordCount# == 0) && (f.Mode.value == 'Next')){
alert('You must add at least one subject line');
return true;
}
//submit the form
f.submit();
}
Bookmarks