Quickform: image as submit button?

From: Date: Thu, 14 Dec 2006 20:55:58 +0000
Subject: Quickform: image as submit button?
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-26098@lists.php.net to get a copy of this message
Hi ========= Question 1 ========= I need to use image as submit button in my Quickform, so I assigned the "value" attribute as "submit". Please find below the way I define the image element. $loginimgargs = array('value' => 'submit', 'id' => 'loginimg', 'onmouseover' => 'FP_swapImg(1,0,/*id*/\'loginimg\',/*url*/\'img/button15.gif\')', 'onmouseout' => 'FP_swapImg(0,0,/*id*/\'loginimg\',/*url*/\'img/button14.gif\')', 'onmousedown' => 'FP_swapImg(1,0,/*id*/\'loginimg\',/*url*/\'img/button16.gif\')', 'onmouseup' => 'FP_swapImg(0,0,/*id*/\'loginimg\',/*url*/\'img/button15.gif\')', 'fp-style' => 'fp-btn: Embossed Capsule 1; fp-font-style: Bold; fp-transparent: 1; fp-proportional: 0', 'fp-title' => 'Log in'); $formAuth->addElement('image', 'loginimg', 'img/button14.gif', $loginimgargs); But when I submit the form by clicking the "loginimg", isset($_POST['loginimg']) returns false! I tried printing all the POST variables of the form and it printed 2 variables "loginimg_x" and "loginimg_y" whose values are the respective coordinates. Now I can simply use "isset($_POST['loginimg_x'])" for the code to work fine, but is it right way to do it or am I doing anything wrong here? ========= Question 2 ========= I validate the Quickform using the rules. But I have two submit buttons in the form, for example, "Login" and "New account" buttons. In this case, the rules need to validated only when I click "Login" button and the rules shouldn't be validated when I click "New account" button. How to achieve this? Please help. Thanks Vignesh.

« previous php.pear.general (#26098) next »