Sometimes, there's a need to override form-level attributes - for example, the only way to disable Firefox's “autocomplete” on textboxes (necessary for credit card numbers, for example) is to set the property on the form tag:
<form autocomplete=“off”>
(see http://developer.mozilla.org/en/docs/How_to_Turn_Off_Form_Autocompletion for details if you want them)
Unfortunately, today, I could not find an easy way to override form-level attributes in QCodo. For Controls, there's a wonderful method SetCustomAttribute; there's nothing like that for forms.
However, QForms do have something that can be used for this purpose - $strFormAttributeArray property of in QFormBase.class.php. If I could do
class MyForm extends QForm {
protected $strFormAttributeArray = array(“autocomplete”=>”off”);
}
then everything would work just fine.. The problem is, I can't. The value of $strFormAttributeArray gets overwritten by an empty array in QFormBase's RenderBegin() method, with the following line:
$this->strFormAttributeArray = array();
A tiny change would make my scenario possible - replacing the line above with:
if (!isset($this->strFormAttributeArray)) {
$this->strFormAttributeArray = array();
}
Mike, can you please make that change in the core? Or, if you have more time, can you add a SetCustomAttribute method to the QForms, just like we have it for QControls?