AJAX and textboxes

G

Guest

I have a form with some textboxes and a button. I'd like for the button to
be disabled until the user enters valid data in either of two of the
textboxes, but can't quite seem to figure out how to accomplish this.
Ideally, I'd like for this to happen without having to post back to the
server, but that's not a biggie.

Any help would be greatly appreciated.

Allen
 
G

Guest

BTW, I put it in the subject line, but failed to mention in the body of the
message that I have the AJAX toolkit installed on my machine.
 
B

bruce barker

it all depends?

what do you mean by valid?
is the button enabled when the user tabs out, or per keystroke?

get any book on javascript and read about onblur, onkeydown,
document.getElementById.

-- bruce (sqlwork.com)
 
G

Guest

The two textboxes I'm interested in are for Member Number and SSN. I thought
of maybe using a regex expression to determine if the SSN textbox contains a
valid SSN. As for the Member Number, I'd like to enable the pushbutton by
keystroke. When the user clicks the button, I'll post the data from one of
the two fields; if the user has entered a value for Member Number, I'll check
it against the DB and pull up the records for the member. Otherwise, I'll
display a popup box stating that the user entered an incorrect Member Number.

Hopefully, this is clear enough to understand ... I know what I want, but
sometimes I can't put it in words ... LOL.
 
M

Michael Nemtsev

Hello AlBruAn,

A> The two textboxes I'm interested in are for Member Number and SSN. I
A> thought of maybe using a regex expression to determine if the SSN
A> textbox contains a valid SSN.

Yep, just use the RegExp class in JS, like var re = new RegExp

As for the Member Number, I'd like to
A> enable the pushbutton by keystroke. When the user clicks the button,
A> I'll post the data from one of the two fields; if the user has

so, as was recommended use the document.getElementById to find your control
and then set .disabled property to true
the same way you can retrieve the values

A> entered a value for Member Number, I'll check it against the DB and
A> pull up the records for the member.

there you need to use the xmlhttprequest to retrieve the data from the server


A> Otherwise, I'll display a popup
A> box stating that the user entered an incorrect Member Number.

use alert(your_Text)

---
WBR, Michael Nemtsev [.NET/C# MVP].
My blog: http://spaces.live.com/laflour
Team blog: http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

A> "bruce barker" wrote:
A>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,772
Messages
2,569,593
Members
45,111
Latest member
KetoBurn
Top