SMOLNET PORTAL home about changes

Image submit buttons on Drupal 5.10

I follow this useful howto by Tom Constant on how to add image submit buttons on Drupal forms. Since I got a JavaScript error on drupal.js (line 31: button is undefined), I rewrite Tom’s implementation, and now it works fine on Drupal 10:

this useful howto by Tom Constant (http://www.tomconstant.com)


function phptemplate_button($element) { // Make sure not to overwrite classes. if (isset($element['#attributes']['class'])) { $element['#attributes']['class'] = 'form-'. $element['#button_type'] .' '. $element['#attributes']['class']; } else { $element['#attributes']['class'] = 'form-'. $element['#button_type']; } // here the novelty begins: check if #button_type is normal submit // button or image button switch($element['#button_type']) { case 'image': $button_type = 'image'; break; default: $button_type = 'submit'; break; } return '<input id="'. $element['#id'].'" name="'. $element['#name'] .'" type="' . $button_type . '" value="'. check_plain($element['#value']) .'" />


https://web.archive.org/web/20080910000000*/http://www.tomconstant.com/2008/01/09/adding-image-submit-buttons-in-drupal-5/ (https://web.archive.org)
Response: 20 (Success), text/gemini
Original URLgemini://chirale.org/2008-09-10_180.gmi
Status Code20 (Success)
Content-Typetext/gemini; charset=utf-8