DCSportbikes.net  
» Help Support .NET!
DCSportbikes Premier Membership for 25$ per year. Discounts! Click here for full information.

Now available in the .NET Shop:



Get your DCSBN Gear!
» Shoutbox
Sorry, only registered users have the ability to use our real-time shoutbox to chat with other members.

Register now, it's free!
» Online Users: 232
2 members and 230 guests
nootherids, Speed3
Most users ever online was 4,519, September 2, 2015 at 03:26 AM.
Go Back   DCSportbikes.net > Non-Sportbike Forums > Non-Sportbike Chat

Reply
LinkBack Thread Tools
anyone here good with javascript form validations or asp.net form controls?
Unread
  (#1)
Noob, 07 600rr
 
jly2k's Avatar
 
Posts: 200
Join Date: October 8, 2004
anyone here good with javascript form validations or asp.net form controls? - May 27, 2008, 10:40 PM

I need some help.
  Send a message via AIM to  
Reply With Quote
Unread
  (#2)
singin sweet home alabama
 
DvlsAdvc8's Avatar
 
Posts: 4,174
Join Date: March 6, 2006
Location: Huntsville, AL
May 27, 2008, 10:48 PM

Quote:
Originally Posted by jly2k
I need some help.
Yep, both; but a couple years ago now. What are you validating?


"No race has ever been won in the first corner, but plenty have been lost there."

Last edited by DvlsAdvc8; May 27, 2008 at 10:59 PM..
  MySpace.com Page Send a message via AIM to Send a message via MSN to DvlsAdvc8  
Reply With Quote
Unread
  (#3)
Noob, 07 600rr
 
jly2k's Avatar
 
Posts: 200
Join Date: October 8, 2004
May 27, 2008, 11:38 PM

I have a form, scripted in C#. Collect form fields (user inputs) and send the results as an email.

On the form, I have a checkbox list and a comment box. If any of the item from the checkbox list is checked, then the comment box would be required. If nothing is in the comment box, pop up error prompt (maybe javascript?)

The RequiredFieldValidator control will validate if the specific field is blank at the time of submission.
  Send a message via AIM to  
Reply With Quote
Unread
  (#4)
MSF Student
 
LoneRider's Avatar
 
Posts: 80
Join Date: May 19, 2007
Location: Rockville
May 27, 2008, 11:46 PM

For .NET I use Visual Studio 2008, form validation is pretty much drag n drop, point n click, the ajax control toolkit has some form validation too. If you dont have Visual Studio you can download Visual Web Developer free, which is still pretty powerful. www.asp.net should have some form validation video tutorials. IMO .NET form validation blows though.

For classic asp, php, or coldfusion, I use Dreamweaver, it has the Spry ajax framework built in, really good form validation for many diff. types, and its super easy and fast to implement. Its just JS so you can really use it in any app.

Also, http://www.ajaxrain.com/ has some good ajax form validation scripts. Easy to implement.
  Send a message via AIM to  
Reply With Quote
Unread
  (#5)
singin sweet home alabama
 
DvlsAdvc8's Avatar
 
Posts: 4,174
Join Date: March 6, 2006
Location: Huntsville, AL
May 28, 2008, 12:17 AM

I haven't done this in awhile so bear with me...

I'd do it in javascript.

You need three functions, one to check your checkbox set, one to check your comment box, and one to run them both on submit. Loop through your checkboxes in one function, and return true if one of 'em is checked. If thats true, run check your comment field.

Something like this:



Code:
 
 
function CheckFields() {
 
  if(OneIsChecked(document.myform.myCheckBox1)) {
    if(WithoutComment(document.myform.myComment)) {
      alert("You must provide a comment");
    }
  }
 
}
 
function OneIsChecked(box) {
    for(var i = 0; i < box.length; i++) {
       if(box[i].checked) { return true; }
    }
    return false;
}
 
function WithoutComment(comment) {
  if(comment.length > 0) { return false }
  return true;
}
Then, just put onSubmit="return CheckFields()" in your form tag.


"No race has ever been won in the first corner, but plenty have been lost there."

Last edited by DvlsAdvc8; May 28, 2008 at 12:22 AM..
  MySpace.com Page Send a message via AIM to Send a message via MSN to DvlsAdvc8  
Reply With Quote
Unread
  (#6)
singin sweet home alabama
 
DvlsAdvc8's Avatar
 
Posts: 4,174
Join Date: March 6, 2006
Location: Huntsville, AL
May 28, 2008, 12:33 AM

I don't remember if the above will work with .net or not... being VS puts a lot of junk in by itself if I recall - particularly concerned with the "onSubmit".

Regardless - you get the idea.


"No race has ever been won in the first corner, but plenty have been lost there."
  MySpace.com Page Send a message via AIM to Send a message via MSN to DvlsAdvc8  
Reply With Quote
Unread
  (#7)
GP Racer
 
boostdacr's Avatar
 
Posts: 994
Join Date: February 21, 2007
May 28, 2008, 04:08 PM

VS 2005 its pretty much drag and drop too, from what i remember.

Edit:
Quote:
Originally Posted by jly2k

The RequiredFieldValidator control will validate if the specific field is blank at the time of submission.
Are you saying that you dont want it to happen when the user hits the button, like right after a checkbox is selected?

Last edited by boostdacr; May 28, 2008 at 04:14 PM..
  Send a message via AIM to  
Reply With Quote
Unread
  (#8)
Noob, 07 600rr
 
jly2k's Avatar
 
Posts: 200
Join Date: October 8, 2004
May 28, 2008, 04:56 PM

Cool. Let me give that a try.
  Send a message via AIM to  
Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Powered by vBadvanced CMPS v3.2.3


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0
vBulletin Skin developed by: vBStyles.com
All logos and trademarks in this site are property of their respective owner. The comments are property of their posters, all the rest 2002-2010 by DCSportbikes.net. DCSportbikes.net is owned by End of Time Studios, LLC.