473,327 Members | 2,074 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Client-side enable/disable button

Hi,

I have a webform with a textbox and a button.

When the textbox is empty (=""), I want the button to be disabled. When
the user enters text in the textbox, the button must be enabled.

Is this possible?

(please if possible, show me the code)

Thanks!!!

M O J O
Nov 19 '05 #1
6 6916
You could do this by making your textbox AutoPostBack=true, and then
dropping some enable/disable code for your button into the event -- but that
would be horribly annoying (lots of postbacks).

A better alternative is probably to look at javascript solutions.

"M O J O" <mojo@_no_spam_delete_this_newwebsolutions.dk> wrote in message
news:OO**************@TK2MSFTNGP15.phx.gbl...
Hi,

I have a webform with a textbox and a button.

When the textbox is empty (=""), I want the button to be disabled. When
the user enters text in the textbox, the button must be enabled.

Is this possible?

(please if possible, show me the code)

Thanks!!!

M O J O

Nov 19 '05 #2
M O J O wrote:
Hi,

I have a webform with a textbox and a button.

When the textbox is empty (=""), I want the button to be disabled.
When the user enters text in the textbox, the button must be enabled.

Is this possible?

(please if possible, show me the code)

Thanks!!!

M O J O


Something like:
<input type="text"
onChange="document.forms[0].myButton.disabled=(this.value='');" >

--

Riki
Nov 19 '05 #3
Hello Riki,

I think you mean (this.value == '');

Otherwise youre consistently setting the value to an empty string.

--
Matt Berther
http://www.mattberther.com
M O J O wrote:
Hi,

I have a webform with a textbox and a button.

When the textbox is empty (=""), I want the button to be disabled.
When the user enters text in the textbox, the button must be enabled.

Is this possible?

(please if possible, show me the code)

Thanks!!!

M O J O

Something like:
<input type="text"
onChange="document.forms[0].myButton.disabled=(this.value='');" >


Nov 19 '05 #4
Hi,

If I use AutoPostBack, this wouldn't be client-side, right? :o) ... but
thanks anyway!

:o)

Regards
Mojo

MWells wrote:
You could do this by making your textbox AutoPostBack=true, and then
dropping some enable/disable code for your button into the event -- but that
would be horribly annoying (lots of postbacks).

A better alternative is probably to look at javascript solutions.

"M O J O" <mojo@_no_spam_delete_this_newwebsolutions.dk> wrote in message
news:OO**************@TK2MSFTNGP15.phx.gbl...
Hi,

I have a webform with a textbox and a button.

When the textbox is empty (=""), I want the button to be disabled. When
the user enters text in the textbox, the button must be enabled.

Is this possible?

(please if possible, show me the code)

Thanks!!!

M O J O


Nov 19 '05 #5
Hi,

Cool thanks!!!

I just made a little correction...

Me.txtMyTextBox.Attributes.Add("OnKeyUp", "document.all." &
Me.cmdMyButtonTlfSøg.ClientID & ".disabled=(this.value=='')")

This works excatly like I wanted.

THANKS!!!!!!!

M O J O
Riki wrote:
M O J O wrote:
Hi,

I have a webform with a textbox and a button.

When the textbox is empty (=""), I want the button to be disabled.
When the user enters text in the textbox, the button must be enabled.

Is this possible?

(please if possible, show me the code)

Thanks!!!

M O J O

Something like:
<input type="text"
onChange="document.forms[0].myButton.disabled=(this.value='');" >

Nov 19 '05 #6
Matt Berther wrote:
Hello Riki,

I think you mean (this.value == '');

Otherwise youre consistently setting the value to an empty string.


Oops!
You're right of course.

--

Riki
Nov 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Michael Rybak | last post by:
hi, everyone. I'm writing a 2-players game that should support network mode. I'm now testing it on 1 PC since I don't have 2. I directly use sockets, and both client and server do...
2
by: Rhino | last post by:
I am trying to verify that I correctly understand something I saw in the DB2 Information Center. I am running DB2 Personal Edition V8.2.1 on Windows. I came across the following in the Info...
0
by: Harley | last post by:
Hello, I am just learning the tcp/ip functions etc under vb.net so please look over me if this is obviouse. I have been all over looking into any functions that I didn't totaly understand and...
8
by: Ankit Aneja | last post by:
i am doing here some some socket-client work in C# windows service it is working fine for multiple clients now i want to limit these multiple clients to 25 for example i want that when service...
2
by: Delmar | last post by:
I need to build Web Application that will generate a client to execute some operations. Each client has running silent application. Maybe somebody can advice me what can I do ? Thank you.
14
by: Ankit Aneja | last post by:
The code of classes given below is for server to which clients connect i want to get ip address of client which has connected pls help how can i get //listen class public class listen {
2
by: Frank Swarbrick | last post by:
I am trying to understand "client authentication" works. My environment is DB2/UDB LUW 8.2 on zSeries SLES9 as the database server and DB2 for VSE 7.4 as the client. We currently have DB2/LUW set...
0
by: khu84 | last post by:
Here is client server very simple code, seems to work with telnet but with with web client code gives blank output. Following is the server code:- <?php function...
2
by: nsaffary | last post by:
hi I hava a client/server program that run correctly when i run it in one computer(local) but when I run client on a one computer and run server run on another, connection does not stablish.(I set...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.