Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Adding Javascript To A Formmailer


  • Please log in to reply
2 replies to this topic

#1 buzzybuz

buzzybuz

  • Members
  • 1 posts
  • OFFLINE
  •  
  • Local time:01:17 AM

Posted 08 February 2006 - 05:54 AM

Hi Guys!

I'm new to this forum, I'm here for some HTML help. I like the smileys btw :thumbsup: !

Anyway, I recently set up a webaccount on a free webhoster. Works great, only problem is that it doesn't support PHP. It's not really a big deal, since I'm not really a PHP coder anyway, but I would like to set up a proper contact form (I dislike mailto links).

I searched google and found a form mailer which displays no ads and has no limitations to the amount of emails to send. It works great, but I would like to add some required fields using javascript. So when a user forgets to fill in his emailaddress in a field, the javascript would detect and report it back to the user.

I searched the formmailer website but I couldn't find a way to let the formmailer do it, therefore I;m asking help with the javascript code. Thanks in advance!

greets.

BC AdBot (Login to Remove)

 


#2 Grinler

Grinler

    Lawrence Abrams


  • Admin
  • 43,593 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:USA
  • Local time:02:17 AM

Posted 09 February 2006 - 12:08 PM

Here is an example:

<html>
<head>
<title>Input validation example</title>

<script language="JavaScript" type="text/javascript">
<!--
function validate( input ) {

  // Check the value of the email field and if empty give an alert.

  if (input.email.value == "") {
	alert( "You must include an email address" );
	return false;
  }

  // Email field is not empty, return true and process the form.
  return true;
}
//-->
</script>
</head>
<body>

<form action="mailto:yourname@yourdomain.com" method="post" onsubmit="return validate(this);">
Enter your email: <input type="text" name="email" />
<input type="submit" name="Send Email" />
</form>
</body>
</html>

This is very basic... you can jazz it up as needed.

This, though, should give you an idea how its done.

#3 garethsoares

garethsoares

  • Members
  • 1 posts
  • OFFLINE
  •  
  • Local time:07:17 AM

Posted 21 June 2016 - 05:40 AM

helped . thanks alot






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users