Re: Re: problem with image button

From: Date: Sun, 01 Oct 2000 01:44:22 +0000
Subject: Re: Re: problem with image button
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-18184@lists.php.net to get a copy of this message
On Sun, 24 Sep 2000, Chris Hayes wrote: > hi there Mark, > > > Let's say I have a form with three image buttons: > > <input type=image name=add src="add.gif"> > > <input type=image name=delete src="delete.gif"> > > <input type=image name=update src="update.gif"> > > > > when I process the form I want to see what button was pressed, but > > instead of add being set, add.x and add.y get set. > > > Unfortunately no JavaScript events can be captured over the form type > 'image'. There are workarounds but they would make you dependable on whethet > people accept javascript por not. JavaScript isn't really an issue in this case. > > now the question is: what's the best way to check which one is set > > since doing this: > > > > if(isset($add.x)) ... > > > > gives a parse error? > > I do not understand the add.x and add.y story. At all. Where do they come > from? When you click on an image submit button, the web browser submits name.x and name.y to inform the form action of where the user clicked. > And this one (same source) is bad news for your plans: > (remember, the suggestion involves a lot of javascript which may exclude > users. the first sentence in the answer seems to be the most important for > you) > > ---- > Q: When using an image input type in a form how can I perform form > validation on form submission? > > A: > > The input type image, is not officially part of specification of a form. I can only assume this faq entry is quite out of date, or the answer was submitted by somebody unfamiliar with the spec. The input type of image is indeed part of the HTML specification, and has been as far back as 1997, possibly longer. The <input> tag is specified here: http://www.w3.org/TR/html401/interact/forms.html#edef-INPUT The use of <input type="image"> is explained here: http://www.w3.org/TR/html401/interact/forms.html#input-control-types Matt

« previous php.general (#18184) next »