...

View Full Version : IIF and textboxes



jason_kelly
12-13-2011, 09:33 PM
Hello,

I need your help,

I can seem to get this to work.

I want to be able to use an IIF to check if a textbox empty ie.


IIF(textbox1 = "" || textbox = null, "it is empty","it is not empty")

This doesnt seem to be working.

Any ideas?

- Clueless =?

Old Pedant
12-13-2011, 11:12 PM
There is no such thing as IIF in JavaScript.

In fact, IIF doesn't even exist in VBScript.

IIF exists in Visual Basic and in VBA (Visual Basic for Applications) and in VB.NET. So far as I know, those are the only places you find it.

In JavaScript, perhaps you are looking for something like this:


var answer = (form.textbox1.value == "" || form.textbox1.vakue == null ) ? "it is empty" : "it is not empty";


Maybe it is time to start here?? http://www.w3schools.com/js/

Old Pedant
12-13-2011, 11:14 PM
By the by, if indeed you are talking about <input name="textbox1" />, then the .value of such a field is *NEVER* empty. Form fields that have a .value property *always* return a STRING for that .value. Yes, it can be an empty string ("") but it can't be null.

So it would be sufficient to code


var answer = ( myform.textbox1.value == "" ) ? "it is empty" : "it is not empty";



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum