Update a text box withOUT using a script?

M

Martin

Hmmm - lets try this again with the correct title :(


I have a page that has some radio buttons on it (<input
type="radio">); there is also a text field (<input type="text">). When
the user clicks one of the radio buttons, I would like to show the
selected button's index number in the text field.

I realize this would be trivial by using a script but I'd like to do
it without a script (to accomodate "scriptless" users).

Is there any way to do this?

TIA
 
S

SpaceGirl

Martin said:
Hmmm - lets try this again with the correct title :(


I have a page that has some radio buttons on it (<input
type="radio">); there is also a text field (<input type="text">). When
the user clicks one of the radio buttons, I would like to show the
selected button's index number in the text field.

I realize this would be trivial by using a script but I'd like to do
it without a script (to accomodate "scriptless" users).

Is there any way to do this?

TIA

No it cannot be done. Anything that changes the content cannot be done
without *some* sort of scripting (the exception being :hover in CSS,
which CAN be used to add sort-of interactivity... except it doesnt work
in IE apart from on hyperlinks).

HTML is "dumb". Once it is rendered that's it. You can do anything else
to it without scripting as it's just a page full of text codes in reality.

--


x theSpaceGirl (miranda)

# lead designer @ http://www.dhnewmedia.com #
# remove NO SPAM to email, or use form on website #
# this post (c) Miranda Thomas 2005
# explicitly no permission given to Forum4Designers
# to duplicate this post.
 
K

Ken in Melbourne Australia

SpaceGirl said:
No it cannot be done. Anything that changes the content cannot be done
without *some* sort of scripting ....
HTML is "dumb". Once it is rendered that's it. You can do anything else
to it without scripting as it's just a page full of text codes in reality.

Cannot be done??? Emmm!! I'm a great believer in never
saying cannot.

If we look at the question it says that we are trying to
accommodate "scriptless" users. Therefore we can assume
that the meaning of script is script running on the client.
Now this may not be the greatest as it means some delays
but couldn't you do it with a program on the Server.

User presses what looks like a radio button. This activates
form output to the server program. Server program resends
page with the text field updated.

Fairly easy program in php on the server I would think.
An HTML question in this is how to get the form to output
back to the host as soon as a radio button is pressed.
Couldn't we replace the form radio buttons with a group of
Submit buttons which have been created to look like radio
buttons?

I haven't tried any of this so maybe there are problems here
that I don't know about. Can anyone tell me if this would
work or if there is a problem with it. Better still, tell
me if you actually get it going!

Ken
in Melbourne
 
M

Martin

Cannot be done??? Emmm!! I'm a great believer in never
saying cannot.

If we look at the question it says that we are trying to
accommodate "scriptless" users. Therefore we can assume
that the meaning of script is script running on the client.
Now this may not be the greatest as it means some delays
but couldn't you do it with a program on the Server.

User presses what looks like a radio button. This activates
form output to the server program. Server program resends
page with the text field updated.

Fairly easy program in php on the server I would think.
An HTML question in this is how to get the form to output
back to the host as soon as a radio button is pressed.
Couldn't we replace the form radio buttons with a group of
Submit buttons which have been created to look like radio
buttons?

I haven't tried any of this so maybe there are problems here
that I don't know about. Can anyone tell me if this would
work or if there is a problem with it. Better still, tell
me if you actually get it going!

Ken
in Melbourne

Ken -

Your approach was exactly what I had in mind if I couldn't figure out
how to do it on the client side. In fact, my next question was going
to be, "how do I get a radio button to submit the form (without using
scripting)?".

The page in question is already being generated by a PHP script so
adding this functionality would be relatively easy.

I'll let you know how it goes.

Thanks.
 
J

Jonathan N. Little

Martin wrote:
Your approach was exactly what I had in mind if I couldn't figure out
how to do it on the client side. In fact, my next question was going
to be, "how do I get a radio button to submit the form (without using
scripting)?".
<snip>

I think this is the Catch-22 part... Only the form's SUBMIT button's
behavior submits the form. To change the default behavior any other form
element, like the RADIO button requires scripting! The only other way
way is to have an 'update' button ,(i.e., a SUBMIT button!) that the
user must click to update the form, just what you are trying to avoid!

<soapbox>

There are applications where client-side scripting is just the 'right'
tool for the job. Fast, responsive, interactive can really enhance the
usability of a webpage without loading the server. But because some
browser's poor security model we have to throw this all out much of time
or find convoluted server-side hacks to try and duplicate what could
easily be done in JavaScript. Wouldn't it be nice to have all the tools
at our disposal?

HTML for content,
CSS for presentation,
CGI for content processing,
AND JavaScript for behavior.

</soapbox>
 
S

SpaceGirl

Ken said:
Cannot be done??? Emmm!! I'm a great believer in never saying cannot.

Can you turn my can of Coke into a car? No. It can't be done.
If we look at the question it says that we are trying to accommodate
"scriptless" users. Therefore we can assume that the meaning of script
is script running on the client. Now this may not be the greatest as it
means some delays but couldn't you do it with a program on the Server.

Yes you could do it at the server, but that's not what I thought he was
asking. He suggested he wanted a scriptless solution. Even if you do it
at the server, a script is being run... albeit on the server :p
User presses what looks like a radio button. This activates form
output to the server program. Server program resends page with the text
field updated.

Yes that would be the way to do it. Use an image of a radio button so
that it "pretends" to be a radio, when really it is a submit button. It
causes the whole thing to be posted to the server and you can then send
the whole back again to the client with the text modified.

I haven't tried any of this so maybe there are problems here that I
don't know about. Can anyone tell me if this would work or if there is
a problem with it. Better still, tell me if you actually get it going!

I've done this on a few sites to fake UI elements; it can work really weel.

--


x theSpaceGirl (miranda)

# lead designer @ http://www.dhnewmedia.com #
# remove NO SPAM to email, or use form on website #
# this post (c) Miranda Thomas 2005
# explicitly no permission given to Forum4Designers
# to duplicate this post.
 

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

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top