Can anyone tell me how to set the disabled property to true or false on the
fly.

Seems like this should be a no brainer but maybe I'm missing something...

If I set the following in a button <input> tag I cannot get it to change

<input id=button1 type=button value=button disabled=false> should enable the
button

<input id=button1 type=button value=button disabled=true> should disable the
button

Actually, what happens is the button disabled property stays set to whatever
the properties window is set to. Changing the property in the tag does not
work.

I want to have the button be enabled or disabled based on who my user is.
For example:

Dim btnState
if rs("pwd") = "admin" then
btnState=false
else
btnState=true
end if

<input id=button1 type=button value=button disabled=<%btnState%>>

This seems to simple but I am obviously missing something.

Thanks for any help...

RE: Setting Button Disabled Property to TRUE or FALSE by ucthakur-NOSPAM

ucthakur-NOSPAM
Fri Mar 17 10:00:28 CST 2006

> <input id=button1 type=button value=button disabled=<%btnState%>>

change to:

<input id=button1 type=button value=button disabled= <% =btnState %> >

-----
Umesh

"Old programmers never die. They just terminate and stay resident."



"glenn" wrote:

> Can anyone tell me how to set the disabled property to true or false on the
> fly.
>
> Seems like this should be a no brainer but maybe I'm missing something...
>
> If I set the following in a button <input> tag I cannot get it to change
>
> <input id=button1 type=button value=button disabled=false> should enable the
> button
>
> <input id=button1 type=button value=button disabled=true> should disable the
> button
>
> Actually, what happens is the button disabled property stays set to whatever
> the properties window is set to. Changing the property in the tag does not
> work.
>
> I want to have the button be enabled or disabled based on who my user is.
> For example:
>
> Dim btnState
> if rs("pwd") = "admin" then
> btnState=false
> else
> btnState=true
> end if
>
> <input id=button1 type=button value=button disabled=<%btnState%>>
>
> This seems to simple but I am obviously missing something.
>
> Thanks for any help...
>
>
>

RE: Setting Button Disabled Property to TRUE or FALSE by glenn

glenn
Fri Mar 17 11:56:30 CST 2006

Ok. I changed this to <% =btnState%> but the property for the button
remains unchanged.
If you hard code the <input> tag for a button to have disabled=true or
false, it will not change when you change the property value from true to
false. It seems this might be a bug. Try it, you will see.

"Umesh Thakur" wrote:

> > <input id=button1 type=button value=button disabled=<%btnState%>>
>
> change to:
>
> <input id=button1 type=button value=button disabled= <% =btnState %> >
>
> -----
> Umesh
>
> "Old programmers never die. They just terminate and stay resident."
>
>
>
> "glenn" wrote:
>
> > Can anyone tell me how to set the disabled property to true or false on the
> > fly.
> >
> > Seems like this should be a no brainer but maybe I'm missing something...
> >
> > If I set the following in a button <input> tag I cannot get it to change
> >
> > <input id=button1 type=button value=button disabled=false> should enable the
> > button
> >
> > <input id=button1 type=button value=button disabled=true> should disable the
> > button
> >
> > Actually, what happens is the button disabled property stays set to whatever
> > the properties window is set to. Changing the property in the tag does not
> > work.
> >
> > I want to have the button be enabled or disabled based on who my user is.
> > For example:
> >
> > Dim btnState
> > if rs("pwd") = "admin" then
> > btnState=false
> > else
> > btnState=true
> > end if
> >
> > <input id=button1 type=button value=button disabled=<%btnState%>>
> >
> > This seems to simple but I am obviously missing something.
> >
> > Thanks for any help...
> >
> >
> >

RE: Setting Button Disabled Property to TRUE or FALSE by ucthakur-NOSPAM

ucthakur-NOSPAM
Fri Mar 17 12:49:28 CST 2006

I guess, once document is loaded, it parses all tags and displays the
elements accordingly. if later, we try to change the tag definition in the
way we did, we won't be able to. at runtime, we should be changing object
properties using HTML DOM Object properties and methods. Here is a nice
example that I think, will help you to do what you want:

http://www.w3schools.com/htmldom/prop_button_disabled.asp


--
-----
Umesh

"Old programmers never die. They just terminate and stay resident."



"glenn" wrote:

> Ok. I changed this to <% =btnState%> but the property for the button
> remains unchanged.
> If you hard code the <input> tag for a button to have disabled=true or
> false, it will not change when you change the property value from true to
> false. It seems this might be a bug. Try it, you will see.
>
> "Umesh Thakur" wrote:
>
> > > <input id=button1 type=button value=button disabled=<%btnState%>>
> >
> > change to:
> >
> > <input id=button1 type=button value=button disabled= <% =btnState %> >
> >
> > -----
> > Umesh
> >
> > "Old programmers never die. They just terminate and stay resident."
> >
> >
> >
> > "glenn" wrote:
> >
> > > Can anyone tell me how to set the disabled property to true or false on the
> > > fly.
> > >
> > > Seems like this should be a no brainer but maybe I'm missing something...
> > >
> > > If I set the following in a button <input> tag I cannot get it to change
> > >
> > > <input id=button1 type=button value=button disabled=false> should enable the
> > > button
> > >
> > > <input id=button1 type=button value=button disabled=true> should disable the
> > > button
> > >
> > > Actually, what happens is the button disabled property stays set to whatever
> > > the properties window is set to. Changing the property in the tag does not
> > > work.
> > >
> > > I want to have the button be enabled or disabled based on who my user is.
> > > For example:
> > >
> > > Dim btnState
> > > if rs("pwd") = "admin" then
> > > btnState=false
> > > else
> > > btnState=true
> > > end if
> > >
> > > <input id=button1 type=button value=button disabled=<%btnState%>>
> > >
> > > This seems to simple but I am obviously missing something.
> > >
> > > Thanks for any help...
> > >
> > >
> > >

RE: Setting Button Disabled Property to TRUE or FALSE by glenn

glenn
Fri Mar 17 17:06:28 CST 2006

Thanks for your reply.

I need the button to be enabled or disabled when the page opens not when the
user clicks on it so I am not sure how to apply the W3Schools example.

For example:
<%
Dim pwd
if pwd="123" then
' enable the button
else
' disable the button
end if



"Umesh Thakur" wrote:

> I guess, once document is loaded, it parses all tags and displays the
> elements accordingly. if later, we try to change the tag definition in the
> way we did, we won't be able to. at runtime, we should be changing object
> properties using HTML DOM Object properties and methods. Here is a nice
> example that I think, will help you to do what you want:
>
> http://www.w3schools.com/htmldom/prop_button_disabled.asp
>
>
> --
> -----
> Umesh
>
> "Old programmers never die. They just terminate and stay resident."
>
>
>
> "glenn" wrote:
>
> > Ok. I changed this to <% =btnState%> but the property for the button
> > remains unchanged.
> > If you hard code the <input> tag for a button to have disabled=true or
> > false, it will not change when you change the property value from true to
> > false. It seems this might be a bug. Try it, you will see.
> >
> > "Umesh Thakur" wrote:
> >
> > > > <input id=button1 type=button value=button disabled=<%btnState%>>
> > >
> > > change to:
> > >
> > > <input id=button1 type=button value=button disabled= <% =btnState %> >
> > >
> > > -----
> > > Umesh
> > >
> > > "Old programmers never die. They just terminate and stay resident."
> > >
> > >
> > >
> > > "glenn" wrote:
> > >
> > > > Can anyone tell me how to set the disabled property to true or false on the
> > > > fly.
> > > >
> > > > Seems like this should be a no brainer but maybe I'm missing something...
> > > >
> > > > If I set the following in a button <input> tag I cannot get it to change
> > > >
> > > > <input id=button1 type=button value=button disabled=false> should enable the
> > > > button
> > > >
> > > > <input id=button1 type=button value=button disabled=true> should disable the
> > > > button
> > > >
> > > > Actually, what happens is the button disabled property stays set to whatever
> > > > the properties window is set to. Changing the property in the tag does not
> > > > work.
> > > >
> > > > I want to have the button be enabled or disabled based on who my user is.
> > > > For example:
> > > >
> > > > Dim btnState
> > > > if rs("pwd") = "admin" then
> > > > btnState=false
> > > > else
> > > > btnState=true
> > > > end if
> > > >
> > > > <input id=button1 type=button value=button disabled=<%btnState%>>
> > > >
> > > > This seems to simple but I am obviously missing something.
> > > >
> > > > Thanks for any help...
> > > >
> > > >
> > > >

Re: Setting Button Disabled Property to TRUE or FALSE by \

\
Sat Mar 18 08:21:10 CST 2006

> I need the button to be enabled or disabled when the page opens not when the
> user clicks on it so I am not sure how to apply the W3Schools example.

The "disabled" property is not a true/false variable. If the keyword "disabled"
is present in the tag, then the button is disabled. The only way to enable the
button is to remove the "disabled" keyword or use the client side script shown
at W3Schools. To preset the state with server side script, the example below is
what you need.

'-----------------button.asp----------------
<%
Dim pwd
if pwd="123" then
stat=""
else
stat="disabled"
end if
%>
<html>
<body>
<input id=button1 type=button <%=stat%> value="Click me!" >
</body>
</html>
'-----------------------------------------------
--
Crash

"If you don't make mistakes, you aren't really trying."
~ Coleman Hawking ~



Re: Setting Button Disabled Property to TRUE or FALSE by glenn

glenn
Mon Mar 20 09:08:37 CST 2006

Thank you so much for your help. It works !!!



""Crash" Dummy" wrote:

> > I need the button to be enabled or disabled when the page opens not when the
> > user clicks on it so I am not sure how to apply the W3Schools example.
>
> The "disabled" property is not a true/false variable. If the keyword "disabled"
> is present in the tag, then the button is disabled. The only way to enable the
> button is to remove the "disabled" keyword or use the client side script shown
> at W3Schools. To preset the state with server side script, the example below is
> what you need.
>
> '-----------------button.asp----------------
> <%
> Dim pwd
> if pwd="123" then
> stat=""
> else
> stat="disabled"
> end if
> %>
> <html>
> <body>
> <input id=button1 type=button <%=stat%> value="Click me!" >
> </body>
> </html>
> '-----------------------------------------------
> --
> Crash
>
> "If you don't make mistakes, you aren't really trying."
> ~ Coleman Hawking ~
>
>
>

Re: Setting Button Disabled Property to TRUE or FALSE by \

\
Mon Mar 20 16:18:40 CST 2006

> Thank you so much for your help. It works !!!

Don't act so surprised. :-)
--
Crash