The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> enable/disable from select
barz
post Apr 12 2014, 11:39 AM
Post #1





Group: Members
Posts: 3
Joined: 18-September 09
Member No.: 9,797



Hi friends!
I have a text field and a dropdownlist
If I type something in the text field the dropdownlist become disabled;
If I select the options 2 or 3 of the dropdownlist the text field become disabled;
If I select the options 1 of the dropdownlist the text field become enabled.

How can I get this with javascript?

thanks!
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Apr 12 2014, 12:19 PM
Post #2


.
********

Group: WDG Moderators
Posts: 9,673
Joined: 10-August 06
Member No.: 7



Which part are you having trouble with?

Bonus questions:

- What if option 4 or higher is selected in the dropdown?

- What if users cut or paste content in the textfield (as opposed to typing)?

- What should happen to users that disable javascript?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
barz
post Apr 12 2014, 12:25 PM
Post #3





Group: Members
Posts: 3
Joined: 18-September 09
Member No.: 9,797



QUOTE(Christian J @ Apr 12 2014, 12:19 PM) *

- What if option 4 or higher is selected in the dropdown?

all options except the first one must disable the text field

QUOTE(Christian J @ Apr 12 2014, 12:19 PM) *

- What if users cut or paste content in the textfield (as opposed to typing)?
i don't care

QUOTE(Christian J @ Apr 12 2014, 12:19 PM) *

- What should happen to users that disable javascript?
i don't care

I've tried with onkeydown and with onchange events but the result isn't good
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Apr 12 2014, 01:59 PM
Post #4


.
********

Group: WDG Moderators
Posts: 9,673
Joined: 10-August 06
Member No.: 7



QUOTE(barz @ Apr 12 2014, 07:25 PM) *

i don't care

You should.

Let a timer check the length of the input filed every split second. That way you should cover all ways the user may enter text.


User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 29th May 2024 - 02:53 AM