Jump to content

button tags


brad_mn1988
 Share

Recommended Posts

Hi,I had a site that I used a very simplistive version of MVC, where the main script reacted to the value of the 'button' attribute of a form. (I use PHP, but it renders HTML [XHTML hopefully] and my question is that.)But, I also wanted to use a translation technique where all the directions and labels and responses depend on the selected language.I was able to do this, but since the value of the button with the <input /> tag was what controlled my logic, I thought I was screwed. But then I found the <button></button> tags!If I had <input type="submit" value="Beer" /> I could change it to <button type="submit" value="Beer">Beer</button>, and no change, then when I swapped in <button type="submit" value="Beer">Cerveza</button> it worked just the same!...This is much more direct, much more intuitive, and separating the "value" of the button from it's "display" text seems more robust (akin to how <select><option> tags work).So I was thrilled, I could place serveral buttons out there and depend on the underlying value= to be rendered from the form, and change the "Label" of the button all I wanted. I could depend on the underlying value= to be the only value returned upon click where I had multiple buttons for multiple actions. I was thrilled and it was all working fabulously!...... in FireFox.Since I only use FireFox for most of what I do I was clobbered with reality when someone I was showing something to inadvertantly used IE instead of FireFox and all I had believed lay in shattered ruins.Since my users are finite, I could insist that they all use FireFox, but...Is there a "simple" way to proceed as I was? FireFox seems to handle the button tags and the value= returned and for the clicked button only effortlessly, is there a way to get IE to behave this way?I fear that the only answer is "messy workaround" and I know that is sadly the common answer with browser compatibility, but the <button> tags seemed to hold so much promise! I hope there is a way.Two Demos:Button Driven - works in FireFox, fails in IE:http://uscsd05.usc.edu/demos/form_render_table2.phpRadio Driven - rewritten from above to work with IE:http://uscsd05.usc.edu/demos/form_render_table.phpThanks in advance,Brad

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...