Form button to have different diplay and CGI value

Hi,
   I want a form button to have different display value than
the value passed to the CGI . How do I do that?
Any pointers are appreciated.


Regards,
Pankaj
pankaj_gargAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

xabiCommented:
You can do two things:

1.- Use a hidden field instead of the button field:

if you have this button:
<input type="button" name="myfield" value="Foo">

You can change into this:

<input type="button" value="foo">
<input type="hidden" name="myfield" value="your_new_value">

2.- You can change the button value before submit the form. This way:

..
..
<script language="javascript">
<!--
function sendit() {
 idform = document.myform
 idform.myfield.value = "New value"
 idform.submit()
}
//-->
</script>
</head>
<html>
..
..
<form name="myform" action="go.htm" method="get">

<input type="button" name="myfield" value="press me">
<input type="button" value="Submit" onClick="sendit()">
</form>

xabi
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
pankaj_gargAuthor Commented:
Thanks a lot...
0
knightEknightCommented:
Another way is to change the value only when the button is pressed -- that way the user sees the correct display value, and the new value is only displayed for a second or so while the form submits:

<INPUT type='submit' value='display val' onClick='this.value="new value";return(true);'>

0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

knightEknightCommented:
oops, as xabi already said  :)
0
Jan LouwerensSoftware EngineerCommented:
can't you just use:

<INPUT TYPE="submit" NAME="sub1" VALUE="Click Me">

the name of the submit button will be "sub1" in the cgi scripts, but will show "Click Me" on the page...
0
Jan LouwerensSoftware EngineerCommented:
Sorry! I misread the question...  I don't know what made me think you wanted a submit button...
0
xabiCommented:
So ... what aabout my points? :)

xabi
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.