473,408 Members | 2,405 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,408 software developers and data experts.

How to decouple submit button's value attrib from displayed text?

kj


Is there a simple way to decouple the value attribute of a submit
button from the text that actually gets displayed on it? In
principle, what I'm looking for is something like

<input type="submit"
name="submitted_via"
value="some string meaningless to the user"
label="Submit Request" />

such that the browser would use the content of the imaginary
attribute "label" (and not that of the attribute "value") to
determine the text that the user will see on the submit button.

I know how to achieve what I need to do with JavaScript, but this
seems like a common enough situation that there may already be a
"built-in/standard" way to do it.

TIA!

kj

--
NOTE: In my address everything before the first period is backwards;
and the last period, and everything after it, should be discarded.
Dec 14 '06 #1
8 7686
..oO(kj)
>Is there a simple way to decouple the value attribute of a submit
button from the text that actually gets displayed on it?
[...]

I know how to achieve what I need to do with JavaScript, but this
seems like a common enough situation that there may already be a
"built-in/standard" way to do it.
Common enough? That's the first time I read about it being an issue.
Why would you want that?

Micha
Dec 14 '06 #2
kj wrote:
Is there a simple way to decouple the value attribute of a submit
button from the text that actually gets displayed on it? In
principle, what I'm looking for is something like

<input type="submit"
name="submitted_via"
value="some string meaningless to the user"
label="Submit Request" />
It would have been a nice feature, but it's not as though it really
exists but is being kept a secret from all but a few. No, the VALUE
attribute is where the label comes from.
Dec 14 '06 #3
Harlan Messinger <hm*******************@comcast.netwrites:
kj wrote:
>Is there a simple way to decouple the value attribute of a submit
button from the text that actually gets displayed on it? In
principle, what I'm looking for is something like

<input type="submit"
name="submitted_via"
value="some string meaningless to the user"
label="Submit Request" />

It would have been a nice feature, but it's not as though it really
exists but is being kept a secret from all but a few. No, the VALUE
attribute is where the label comes from.
How well-supported are button elements? Shouldn't something like this
be suitable?

<button name="submitted_via" value="some string">Submit Request</button>

sherm--

--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
Dec 14 '06 #4
Scripsit kj:
Is there a simple way to decouple the value attribute of a submit
button from the text that actually gets displayed on it?
No. So please start from the original problem, instead of this assumed
solution, which is probably a dead end - even though the original problem
may have a solution. Besides, reconsider the choice of group. This doesn't
seem to be a stylesheet question at all.
<input type="submit"
name="submitted_via"
value="some string meaningless to the user"
label="Submit Request" />

such that the browser would use the content of the imaginary
attribute "label" (and not that of the attribute "value") to
determine the text that the user will see on the submit button.
There are unreliable ways to do something like that, by using the button
element:

<button type="submit" name="submitted_via"
value="some string meaningless to the user">
Submit Request
</button>

The main practical problem with that is that IE does not support it, not
even in IE 7.
I know how to achieve what I need to do with JavaScript,
Do you really need to get different data depending on whether the user's
browser has scripting enabled or not?

Your form handler should just _use_ what it gets. The name="..." attribute
value can internally, in the server-side script, be mapped to whatever you
want.

Your main problem might be related to knowing which button was used to
submit the form. The short answer is that there is really no reliable way to
do that, so it's better to design things differently.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Dec 14 '06 #5
Sherm Pendley wrote:

[snip]
How well-supported are button elements?
Well, in most browsers. Not at all, effectively, in MSIE. The problems
that I'm aware of are described in a post I sent to c.l.javascript last
month.

Subject: Re: Question from newbie
Date: Mon, 06 Nov 2006 18:59:07 GMT
Message-ID: %B*******************@text.news.blueyonder.co.uk

<http://groups.google.co.uk/group/comp.lang.javascript/msg/f84a1dc2feddc40a>
Shouldn't something like this be suitable?

<button name="submitted_via" value="some string">Submit Request</button>
Unlikely. :-(

Mike
Dec 15 '06 #6
kj
In <tH*****************@reader1.news.saunalahti.fi"Ju kka K. Korpela" <jk******@cs.tut.fiwrites:
>Your form handler should just _use_ what it gets. The name="..." attribute
value can internally, in the server-side script, be mapped to whatever you
want.
My question clearly sought ways around this obvious but deficient
solution. Deficient because it requires the server-side code to
be aware of functionally irrelevant GUI details, i.e. the string
that the GUI designer chooses for the label on the button. If the
designer changes his/her mind (which happens all the time), the
server-side programmer must change the corresponding code. A much
better solution is to fix this value once and for all and make it
independent of the GUI representation.

Judging from the responses I am amazed, after all these years of
hearing about the importance of indirection, that the general
consensus is that such a feature is unimportant. It seems to me
*essential*, if one wants to decouple the GUI from the guts of the
program.

I hope that I'm missing something...

kj

--
NOTE: In my address everything before the first period is backwards;
and the last period, and everything after it, should be discarded.
Dec 16 '06 #7
Scripsit kj:
>Your form handler should just _use_ what it gets. The name="..."
attribute value can internally, in the server-side script, be mapped
to whatever you want.

My question clearly sought ways around this obvious but deficient
solution.
Your question is still off-topic and wrong.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/
Dec 16 '06 #8
kj wrote:
In <tH*****************@reader1.news.saunalahti.fi"Ju kka K. Korpela" <jk******@cs.tut.fiwrites:
>Your form handler should just _use_ what it gets. The name="..." attribute
value can internally, in the server-side script, be mapped to whatever you
want.

My question clearly sought ways around this obvious but deficient
solution. Deficient because it requires the server-side code to
be aware of functionally irrelevant GUI details, i.e. the string
that the GUI designer chooses for the label on the button. If the
designer changes his/her mind (which happens all the time), the
server-side programmer must change the corresponding code. A much
better solution is to fix this value once and for all and make it
independent of the GUI representation.
How about this work-around?

<input type="submit" name="button1" value="Yes">
<input type="submit" name="button2" value="No">
<input type="submit" name="button3" value="Maybe">
<input type="submit" name="button4" value="Don't care">

[On the server, in pseudo-code]
var theValue = none;
for each possible value V do
{
if EXISTS(REQUEST("button" + V))
{
theValue = V;
break;
}
}

[Or, instead]
var theValue = none;
for each name(N)/value pair submitted
{
if N starts with "button"
{
theValue = the part of N that follows "button";
break;
}
}

>
Judging from the responses I am amazed, after all these years of
hearing about the importance of indirection, that the general
consensus is that such a feature is unimportant. It seems to me
*essential*, if one wants to decouple the GUI from the guts of the
program.

I hope that I'm missing something...
I don't think it's unimportant. I thought all along that it showed a
remarkable lack of forethought. The BUTTON tag was meant to fix that
problem, but as you've been told, Microsoft never bothered to support
it. I wondering if you're interpreting the sentiment "there isn't
anything any of us developers can do about it, so let's move on" as a
sense that it isn't important.
Dec 17 '06 #9

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

Similar topics

2
by: Richard B. | last post by:
Hi, Currently designing/building my first class/template driven site. Inside a PHP form a list of article titles are displayed along with the first two lines of the article. When the user...
4
by: Eric | last post by:
Hey Everyone.. I have a form that has approximately 7 text fields and 1 checkbox. Generally when this form is submitted(to itself BTW) it works fine, however, when the checkbox is only field...
10
by: Gregory A Greenman | last post by:
I'm trying to write a program in vb.net to automate filling out a series of forms on a website. There are three forms I need to fill out in sequence. The first one is urlencoded. My program is...
15
by: M Smith | last post by:
I have a form I want to submit to itself. I want to be able to type in a list of numbers and submit the form and have that list show up on the same form under the text box I typed them into and...
8
by: horos | last post by:
hey all, Ok, a related question to my previous one on data dumpers for postscript. In the process of putting a form together, I'm using a lot of placeholder variables that I really don't care...
0
by: Wysiwyg | last post by:
Hi, I just thought I'd post this since I didn't see anyone else doing it this way. I wanted to be able to force the enter key to submit the form without manually changing the html form, In my...
5
by: Navillus | last post by:
Hey gang, I have a login form that is empty by default, but can be filled with values from a previous form: <input type=text maxlength="40" size="40" name="user" value="`usr`"> <input...
5
by: Simon Benson | last post by:
Probably a fairly simple problem but one that's been plaguing me for a couple of days... can anyone help? I have a classic ASP page with a number of text boxes which are updatable. For...
12
by: Daniel Klein | last post by:
I'm pretty new at php and web stuff so please be gentle with me. I'm trying to get a form to submit when the user presses the Enter key. I do not want to use javascript. I've googled this to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.