View Full Version : Mandatory text field

12-28-2006, 10:44 PM
I am trying to make a Javascript code for my text field that doesn't allow the user to continue unless the "Account Number" is filled in. I thought I did it right, but apparently not. Is it because the submit button's value is "image" ? or is it because I have no idea what I am doing and below is more like a Frankenstein code?
Thanks in advance

Here is my code, can you please tell me where I've got it wrong?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<meta http-equiv="Content-Type" content="text/html;

<meta name="GENERATOR" content="WYSIWYG Web Builder -

<body bgcolor="#000000" text="#000000"


<style type="text/css" media="screen"><!--
#layer1 { visibility: visible; position: absolute; z-index: 1; top:

0; left: 0; width: 100%; height: 100% }
#layer2 { visibility: visible; position: absolute; z-index: 2; top:

63px; left: 55px; width: 100%; height: 100% }

<body bgcolor="#ffffff">

<div align="center">
<div id="layer1">
<div id="layer2">
<div align="center">
<table width="100%"

border="0" cellspacing="0" cellpadding="0" align="center" height="600">

<SCRIPT language="JavaScript">
function noEntry() {
if (document.tmaster.os0_1.value.length<1) {
alert("Please fill in Your Account Number");
return false; }
else { return true; }
// -->

<form name="tmaster"

action="https://www.paypal.com/cgi-bin/webscr" onsubmit="return

noEntry()" method="post">

<div align="center">

<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="gmkfit@yahoo.com"> <input

type="hidden" name="item_name" value="Online Payment - Orlando">
<input type="hidden" name="no_shipping" value="2">
<input type="hidden" name="return" value="http://www.turfmaster.cc">
<input type="hidden" name="cancel_return"

<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="bn" value="PP-BuyNowBF">

<td><b><font size="5">Orlando Service Area - Paypal



<td><input type="hidden"

name="on_0" value="Account Number"><b>Account Number</b></td>

<td><input type="text"

name="os_0" maxlength="200"></td>



<input type="image"

src="https://www.paypal.com/en_US/i/btn/x-click-but6.gif" border="0"

name="button" alt="Make payments with PayPal - it's fast, free and

<img alt="" border="0"

src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1"







12-28-2006, 11:31 PM
I didn't test it but it looks like you have the wrong name. The html shows:

<input type="text" name="os_0" maxlength="200">

but your javascript shows:

if (document.tmaster.os0_1.value.length<1) {

So try making that if statement:

if (document.tmaster.os_0.value.length<1) {

In the future try to put long code in a CODE area (use the # button above the text entry area).


12-28-2006, 11:38 PM
that was it david_kw!

thank you very much!

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum