OutFront Forums
     Home    Register     Search      Help      Login    

Sponsors
Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax
Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.
Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Follow Us
On Facebook
On Twitter
RSS
Via Email

Recent Posts
Todays Posts
Most Active posts
Posts since last visit
My Recent Posts
Mark posts read

 

I need help with a Drop Down Validation

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP, PHP, and Database >> I need help with a Drop Down Validation
Page: [1]
 
 
DaveKstl

 

Posts: 553
Joined: 4/21/2004
Status: offline

 
I need help with a Drop Down Validation - 6/15/2009 6:54:41   
I have a dynamic drop down that uses ONCHANGE='Form1.submit();'
The drop down is populated with a query.

The problem is I do not get form validation when a selection in made in the drop down. If I remove the ONCHANGE='Form1.submit();', it works just fine.

Is there a way to get an Onchange submit to validate a form field? I have other text fields I validate and they work.

Thanks

Dave
TexasWebDevelopers

 

Posts: 761
Joined: 2/22/2002
From: Dallas, TX
Status: offline

 
RE: I need help with a Drop Down Validation - 6/15/2009 18:42:54   
If it's a drop down you don't need to validate for content --it's either there or the form hasn't been submitted. Or do you mean how do you validate the OTHER fields when using onChange Submit? If so, how are you validating now? The Front Page (worthless) validation? Live validation? JQuery? Dojo? ASP?

_____________________________

:)

Follow us on TWITTER

(in reply to DaveKstl)
DaveKstl

 

Posts: 553
Joined: 4/21/2004
Status: offline

 
RE: I need help with a Drop Down Validation - 6/16/2009 8:18:22   
I am validating other fields using Javascript. The question I have is the OnChange Submit syntax. Does this negate form validation for a drop down?

Dave

(in reply to TexasWebDevelopers)
TexasWebDevelopers

 

Posts: 761
Joined: 2/22/2002
From: Dallas, TX
Status: offline

 
RE: I need help with a Drop Down Validation - 6/16/2009 10:41:08   
No--you could validate on change and if the field validates then submit.
I cannot imagine a form you describe being very user friendly. If you have five form elements and three are text boxes and one is a radio button and one is a drop down then the user would be confused because there isn't a submit button...how would they know that the dropdown fires the form submission? I suppose you could disable the submit button until validation is complete something like this:

<script language="JavaScript" type="text/javascript">
<!--
window.onload=init;

function init() {
document.getElementById("submit_it").disabled=true;
}
function checkFields() {
// I want to make sure that man1 and man2 are not empty
// and that the select field value is also not empty
// before enabling the submit button
var f1 = document.getElementById("field1").value;
var f2 = document.getElementById("field2").value;
var f3 = document.getElementById("field3").selectedIndex;

if (f1.length>2 && f2.length>2 && f3>-0) {
// form1.submit();
document.getElementById("submit_it").disabled=false;
} else {
document.getElementById("submit_it").disabled=true;
}
}
-->
</script>
<form id="form1" name="form1" action="your-page.asp" method="post">
<p><input type="text" name="field1" id="field1" value="" onkeyup="checkFields();" />
<p><input type="text" name="field2" id="field2" value="" onkeyup="checkFields();" />
<p>
<select name="field3" id="field3" onchange="checkFields();">
<option value="">--Select something--</option>
<option value="1">number one</option>
<option value="2">number two</option>
</select>
<p><input type="submit" name="submit_it" id="submit_it" value="Submit the Form" />
</form>

_____________________________

:)

Follow us on TWITTER

(in reply to DaveKstl)
Page:   [1]

All Forums >> Web Development >> ASP, PHP, and Database >> I need help with a Drop Down Validation
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts