Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Button problem

Status
Not open for further replies.

aharrisreid

Programmer
Nov 17, 2000
312
GB

I want to have a submit button on a form, and when submitted, I want to be able to retrieve data from the called page as to whether it was called from the button press or via another method (eg. if 'enter' was pressed).

Ideally I would like to use a button created using <input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;Report&quot;>, as the name/value pair are posted to the next page. The problem with the resulting button is that I cannot see any way to change font, size or color of button text, so I am limited to a very boring-looking button. Is there any way around this? I tried changing the font attributes of the table cell containing the button, but the button still looked the same.

To solve the appearance problems I could create the button using <button>...</button> tags, but the problem this is that the posted value is always the same, whether the button was pressed or not, so I cannot tell if the button was pressed to access the next page. Also, the posted value contains all sorts of useless information regarding font size, type, etc. - I only want the value=&quot;...&quot; text.

Any help would be appreciated. I would prefer a plain HTML solution if possible, but failing that, a Javascript solution would do.

TIA,
Alan
 
This should do both of your requests:
<form name=&quot;the_form&quot;>
<input type=&quot;hidden&quot; name=&quot;how&quot;>
<input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;Report&quot; style=&quot;background-color:blue;color:white;&quot; onClick=&quot;document.the_form.how.value='by clicking button';&quot;>
</form>

Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top