Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Help Groups for Snitz Forums 2000 Users
 Help: General / Classic ASP versions(v3.4.XX)
 Help w/ Javascript Please: Posting Form Validation
 New Topic
 Printer Friendly
Author  Topic Next Topic  

bobby131313
Senior Member

USA
1163 Posts

Posted - 02 August 2017 :  10:46:36  Show Profile  Visit bobby131313's Homepage  Reply with Quote
Below is the standard JS that makes sure the Subject and Message are not empty when posting a new topic. I would like it to make sure the Subject is at least 20 characters instead of just not empty. I'm very javascript challenged.

function validate(){
	if (document.PostTopic.Subject) {
		if (trim(document.PostTopic.Subject.value)=="") {
			alert("You must enter a Subject")
			return false
		}
	}
	if (document.PostTopic.Message) {
		if (trim(document.PostTopic.Message.value)=="") {
			alert("You must enter a Message")
			return false
		}
	}
	document.PostTopic.Submit.disabled = true
	return true
}

Switch the order of your title tags

HuwR
Forum Admin

United Kingdom
20579 Posts

Posted - 03 August 2017 :  04:17:44  Show Profile  Visit HuwR's Homepage
something like

if (document.PostTopic.Subject) {
if (trim(document.PostTopic.Subject.value)=="") {
alert("You must enter a Subject")
return false
}
if (document.PostTopic.Subject.value.length < 20) {
alert("You must enter a longer Subject")
return false
}
}

MVC .net dev/test site | MVC .net running on Raspberry Pi
Go to Top of Page

bobby131313
Senior Member

USA
1163 Posts

Posted - 03 August 2017 :  07:28:24  Show Profile  Visit bobby131313's Homepage
Thanks! I'll give it a try today.

Switch the order of your title tags
Go to Top of Page
   Topic Next Topic  
 New Topic
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.24 seconds. Powered By: Snitz Forums 2000 Version 3.4.07