CiviCRM change QuickForm Cancel button's value
Join the DZone community and get the full member experience.
Join For FreeQuickForm automatically creates the Cancel button as part of the buttons array. Use this code in the .php controller code if you want to change the HTML value of the button. Note that the generated HTML uses <input> and not <button>, so the label and the value will be identical.
// Get the buttons array, find the Cancel button, change the label
$new_buttons_obj = $this->getElement('buttons');
foreach ($new_buttons_obj->_elements as $e) {
if ($e->_attributes['value']=='Cancel') {
$e->setValue('Cancel and return to previous page');
}
}
HTML
Label
Data structure
Opinions expressed by DZone contributors are their own.
Comments