473,788 Members | 2,816 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 7705
..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.new s.blueyonder.co .uk

<http://groups.google.c o.uk/group/comp.lang.javas cript/msg/f84a1dc2feddc40 a>
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.n ews.saunalahti. fi"Jukka K. Korpela" <jk******@cs.tu t.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.n ews.saunalahti. fi"Jukka K. Korpela" <jk******@cs.tu t.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
3242
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 clicks on the article title the form with the list of article titles is replaced with the full text of the article selected. Since the article ID for the article title selected determines which article
4
4298
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 that has been modified/clicked the form doesn't always submit. When it does work, a Stored procedure is passed form variables and updates to the db are made. When it doesn't, its as if the form wasn't submitted, it reloads and resets the page, but...
10
19361
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 able to fill that one out just fine. The second form is multipart/form-data. Unfortunately, I haven't been able to fill that out in a way that makes the server happy. I set up a copy of this form at my web site so that I could see exactly what a...
15
6579
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 the buttons. The problem is when I post a form to itself, the Enter key will not submit the form, it only clears the contents of the text box. The only way I can submit is to click the submit button. Here is a simplified version of my code that I...
8
3372
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 about in the submitted action. I'd therefore like to get rid of them by doing something like:
0
1168
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 custom base page class I added a generic method I can call to handle the user pressing the enter key when I want it to submit the form. This sets the destination button on a for the entire form rather than on a field-by-field basis; i.e. it's not...
5
17713
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 type=password maxlength="8" name="password" value="`pss`"> where usr and pss are sent from the previous form.
5
5701
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 convenience I want to add 'tabs' at the top of the page (like a card index) as the data to be displayed is split into specific groups (client, company, preferences, events). How do I update any changes to the data and switch to a different page - at
12
6954
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 death and cant find the answer (only hints), except on the 'Experts Exhange' page and you have to pay to get the answer :-( Why is this such a secret in the open source world we live in? Daniel Klein
0
9656
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9498
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10364
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10110
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8993
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6750
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4069
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.