Re: Button id's - firefox and IE different ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Peter Ford wrote:
> Angus Mann wrote:
>> Hi all.
>>
>> I want to have several delete buttons with just one form, and depending on which button is pressed, one of several items is deleted.
>>
>> So I need multiple submit buttons for 1 form, each displaying the same text "Delete" to the user, but each with a different "value" so the PHP script can tell them apart.
>>
>> I've used this code for the buttons...
>> <center><button type="submit" name="btid" value="1">Delete</center>
>> <center><button type="submit" name="btid" value="2">Delete</center>
>> <center><button type="submit" name="btid" value="3">Delete</center>
>>
>> And it works just fine with firefox. But IE does not seem to pass the value back to the btid so when the script asks 
>> if $_POST['btid'] == "1" {
>> }
>>
>> the value 1, 2, or 3 is not given back to PHP by IE. It is given back correctly by firefox and works fine.
>>
>> Any suggestions ?
>>
>> Thanks.
>>
>>
> 
> Well, to answer your initial question, IE won't play like that - it uses the
> content of the button as the value and no amount of telling it is going to
> change that at present... I suspect this behaviour is one of those things that
> is ambiguously specified by the standards.
> 
> The real question is ... why do you want to do that (tell the buttons apart, I
> mean)? From a user's perspective, if they are labelled the same, and in the same
> form, then surely they must do the same thing? Sounds like the form design needs
> to fresh thought.
> 
> If you must do it like you this, you need to change the labels on the buttons,
> but remember: when you come to internationalize your site with twenty-six
> different languages then you'll have to check each possible translation in the
> back-end code. And if you decide to put images on the buttons instead of words
> then you are really up the creek...
> 
> Either: split the form up so that different delete buttons act on their
> respective bits of the form.
> Or: bite the bullet and use javascript onclick events to set a hidden field
> which signals what the action is supposed to be in the back end.
> 

There's a third option: make sure your clients only use Firefox :)

-- 
Peter Ford                              phone: 01580 893333
Developer                               fax:   01580 893399
Justcroft International Ltd., Staplehurst, Kent

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux