BUG 9886 Duplicated cases when clicking various times in the submit ...SOLVED

- For some reason when you click various times in the submit button, it will create a duplicate case.
- Disabled Button after clicked.
This commit is contained in:
Hector Cortez
2013-01-28 12:11:34 -04:00
parent 6e32d4fe39
commit eb33688d88

View File

@@ -3240,10 +3240,13 @@ class XmlForm_Field_Submit extends XmlForm_Field
public function render ($value = null, $owner = null) public function render ($value = null, $owner = null)
{ {
$onclick = G::replaceDataField( $this->onclick, $owner->values ); $onclick = G::replaceDataField( $this->onclick, $owner->values );
if ($onclick != '') {
$onclick = "this.disabled=true;" . $onclick;
}
if ($this->mode === 'edit') { if ($this->mode === 'edit') {
// if ($this->readOnly) // if ($this->readOnly)
// return '<input id="form['.$this->name.']" name="form['.$this->name.']" type=\'submit\' value=\''. $this->label .'\' disabled/>'; // return '<input id="form['.$this->name.']" name="form['.$this->name.']" type=\'submit\' value=\''. $this->label .'\' disabled/>';
return "<input style=\"{$this->style}\" class='module_app_button___gray {$this->className}' id=\"form[{$this->name}]\" name=\"form[{$this->name}]\" type='submit' value=\"{$this->label}\" " . (($this->onclick) ? 'onclick="' . htmlentities( $onclick, ENT_COMPAT, 'utf-8' ) . '"' : '') . " />"; return "<input style=\"{$this->style}\" class='module_app_button___gray {$this->className}' id=\"form[{$this->name}]\" name=\"form[{$this->name}]\" type='submit' value=\"{$this->label}\" " . (($this->onclick) ? 'onclick="' . htmlentities( $onclick, ENT_COMPAT, 'utf-8' ) . '"' : 'onclick="this.disabled=true;");\'') . " />";
} elseif ($this->mode === 'view') { } elseif ($this->mode === 'view') {
//return "<input style=\"{$this->style};display:none\" disabled='disabled' class='module_app_button___gray module_app_buttonDisabled___gray {$this->className}' id=\"form[{$this->name}]\" name=\"form[{$this->name}]\" type='submit' value=\"{$this->label}\" " . (($this->onclick) ? 'onclick="' . htmlentities ( $onclick, ENT_COMPAT, 'utf-8' ) . '"' : '') . " />"; //return "<input style=\"{$this->style};display:none\" disabled='disabled' class='module_app_button___gray module_app_buttonDisabled___gray {$this->className}' id=\"form[{$this->name}]\" name=\"form[{$this->name}]\" type='submit' value=\"{$this->label}\" " . (($this->onclick) ? 'onclick="' . htmlentities ( $onclick, ENT_COMPAT, 'utf-8' ) . '"' : '') . " />";
//$sLinkNextStep = 'window.open("' . $owner->fields['__DYNAFORM_OPTIONS']->xmlMenu->values['NEXT_STEP'] . '", "_self");'; //$sLinkNextStep = 'window.open("' . $owner->fields['__DYNAFORM_OPTIONS']->xmlMenu->values['NEXT_STEP'] . '", "_self");';