-
How to change form elements dynamically?
Hi,
Can anyone direct me to sample code or a tutorial or discussion as to how
I can change a form's elements dynamically, without hitting the server?
I've seen this on a Microsoft search site, where the User chooses HOW they
want to search via Radio buttons, and based on HOW they chose, the Web page
instantly refreshes (without hitting the server) so as to show a Text input
box or a Select list, etc. I assume this is done in DHTML, but I can't figure
out how to pull it off.
Any leads would be appreciated!
Take care,
Dave Straley
-
Re: How to change form elements dynamically?
You can do this with the CreateElement function. See here for details and
example:
http://msdn.microsoft.com/workshop/A...ods/createElem
ent.asp
steve
"Dave Straley" <djs@sandyhook.com> wrote in message
news:38cd4a4e$1@news.devx.com...
>
> Hi,
>
> Can anyone direct me to sample code or a tutorial or discussion as to how
> I can change a form's elements dynamically, without hitting the server?
> I've seen this on a Microsoft search site, where the User chooses HOW they
> want to search via Radio buttons, and based on HOW they chose, the Web
page
> instantly refreshes (without hitting the server) so as to show a Text
input
> box or a Select list, etc. I assume this is done in DHTML, but I can't
figure
> out how to pull it off.
>
> Any leads would be appreciated!
> Take care,
> Dave Straley
-
Re: How to change form elements dynamically?
Steve,
Thanks a ton for that link. I checked it out and it's impressive. However,
it's not quite what I've seen in action on the MS site. For example, the
createElement() function says that it can't create Select lists. However,
on the MS site, when the User chose a certain Radio button, a select list
appeared.
The best that I can guess is that this is done with CSSS' layering capabilities,
presumably raising a different layer to the top? But I stil don't know how
to pull it off.
In my application, I do need to show/hide a select list vs. a text input
box, depending on which Radio button the User chose.
Thanks again,
Take care,
Dave Straley
"Steve Cochran" <scochran@chattanooga.net> wrote:
>You can do this with the CreateElement function. See here for details and
>example:
>
>http://msdn.microsoft.com/workshop/A...ods/createElem
>ent.asp
>
>steve
-
Re: How to change form elements dynamically?
Hi Dave,
Well this was a bit trickier than I thought, but it should give you what you
want:
<HTML>
<BODY>
<p><Input name=rad1 type=radio onclick="whichrad()" language=vbs>First radio
<p><Input name=rad1 type=radio onclick="whichrad()" language=vbs>Second
radio
<p><input name=txt1 type=text value="" size=15 style="display:none">
<p><select name=sel1 size=1 style="display:none">
<option value=1>option1
<option value=2>option2
<option value=3>option3
</select>
<script langauge=vbs>
sub whichrad()
if rad1(0).checked="True" then
txt1.style.display=""
sel1.style.display="none"
elseif rad1(1).checked="True" then
txt1.style.display="none"
sel1.style.display=""
end if
end sub
</script>
</BODY>
</HTML>
The MSDN library is an invaluable site, I find, although at times I still
have to figure things out by myself. <G>
cheers,
steve
"Dave Straley" <djs@sandyhook.com> wrote in message
news:38ce45f4@news.devx.com...
>
> Steve,
>
> Thanks a ton for that link. I checked it out and it's impressive.
However,
> it's not quite what I've seen in action on the MS site. For example, the
> createElement() function says that it can't create Select lists. However,
> on the MS site, when the User chose a certain Radio button, a select list
> appeared.
>
> The best that I can guess is that this is done with CSSS' layering
capabilities,
> presumably raising a different layer to the top? But I stil don't know
how
> to pull it off.
>
> In my application, I do need to show/hide a select list vs. a text input
> box, depending on which Radio button the User chose.
>
> Thanks again,
> Take care,
> Dave Straley
>
>
>
> "Steve Cochran" <scochran@chattanooga.net> wrote:
> >You can do this with the CreateElement function. See here for details
and
> >example:
> >
>
>http://msdn.microsoft.com/workshop/A...hods/createEle
m
> >ent.asp
> >
> >steve
>
-
Re: How to change form elements dynamically?
Steve,
Wow! That's great! You gave me a solution which works "right out of the
box"! Thanks so much. The behavior of the form elements is just what I
was looking for. I owe you one, Steve!
Take care,
Dave Straley
"Steve Cochran" <scochran@chattanooga.net> wrote:
>Hi Dave,
>
>Well this was a bit trickier than I thought, but it should give you what
you
>want:
>
-
Re: How to change form elements dynamically?
Happy to help.
Don't put it inside of a form though. It screws up then.
cheers,
steve
"Dave Straley" <djs@sandyhook.com> wrote in message
news:38d0ec32$1@news.devx.com...
>
> Steve,
>
> Wow! That's great! You gave me a solution which works "right out of the
> box"! Thanks so much. The behavior of the form elements is just what I
> was looking for. I owe you one, Steve!
>
> Take care,
> Dave Straley
>
>
> "Steve Cochran" <scochran@chattanooga.net> wrote:
> >Hi Dave,
> >
> >Well this was a bit trickier than I thought, but it should give you what
> you
> >want:
> >
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks