Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Andrzejek on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Blank Field to be defaulted to 0.00 1

Status
Not open for further replies.

Lambro

Programmer
Aug 22, 2001
258
US
I have a payment field on a form that is numeric only allowed. The default value of the field is 0.00

If I enter a dollar figure in then I decide to clear it out then the field will be blank. How do I always keep 0.00 in the field only if it's blank. I used an onblur but my code won't work.

function DAmount() {
if (DollarAmount == "")
{
DollarAmount == "0.00"
}
}


onblur="DAmount()
 
Try:
Code:
function DAmount( field )
{	if( field.value == "" )	field.value = "0.00";
}

onblur = "DAmount(this)";
 
put the function on the onchange event for that box. and/or on the form reset

[thumbsup2]DreX
aKa - Robert
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top