Does anyone know how to make a field auto submit with the onChange="this.form.submit"
I have a form with a single field, and it would be better for the onchange instead of clicking a button.
What I have so far and what I have tried:
$provider = $_COOKIE['memberID'];
$client = $this->oProfileGen->_iProfileID;
$aForm = array(
'form_attrs' => array(
'name' => 'form_personal_notes',
'method' => 'post',
),
'params' => array (
'db' => array(
'table' => 'personal_notes', // table name
'key' => 'personal_notes_id', // key field name
'uri' => '', // uri field name
'uri_title' => '', // title field to generate uri from
'submit_name' => 'submit_personal_notes_form', // some filed name with non empty value to determine if the for was submitted,
// in most cases it is submit button name
),
'csrf' => array(
'disable' => true, //if it wasn't set or has some other value then CSRF checking is enabled for current form, take a look at sys_security_form_token_enable to disable CSRF checking completely.
)
),
'inputs' => array(
'header1' => array(
'type' => 'hidden',
'caption' => 'Personal Notes',
),
'Note' => array(
'type' => 'textarea',
'name' => 'Note',
'html' => 3,
'html_dynamic' => true,
'attrs' => array(
'id' => 'note',
'onChange' => this.form.submit(), /* ( also tried replacing section in red with: "javascript:document.forms['form_personal_notes'].submit();" ) */
),
'colspan' => true,
'db' => array (
'pass' => 'Xss',
),
),
'header1_end' => array(
'type' => 'block_end'
),
'submit_send' => array(
'type' => 'submit',
'colspan' => true,
'name' => 'submit_personal_notes_form',
'value' => _t("Update Personal Notes"),
),
),
);
$oForm = new BxTemplFormView ($aForm);
$oForm->initChecker();
if ($oForm->isSubmittedAndValid ()) {
$time = time();
$wall = mysql_query("INSERT INTO bx_wall_events (owner_id, object_id, type, content, title, description, date) VALUES ('$client', '$provider', 'wall_common_text', '<div class="wall-post-text bx-def-font-h2">Personal Notes Updated.</div>', 'Personal Notes Updated.', 'Personal Notes Updated.', '$time')");
// add additional vars to database, in this case creation date field is added
$aValsAdd = array (
'client_id' => $this->oProfileGen->_iProfileID,
'input_by' => $_COOKIE['memberID'],
);
if ($oForm->insert ($aValsAdd)) {
$sStatusText = 'Personal Notes Updated Successfully';
}
}
if($sStatusText)
$sStatusText = MsgBox(_t($sStatusText), 3);
return array($sStatusText . $oForm->getCode(), array(), array(), false);
Using firebug, i get:
<textarea id="note" class="form_input_textarea bx-def-font form_input_html" name="note" onchange="this.form.submit()" style="display: none;" aria-hidden="true"></textarea>
Any help would be greatly appreciated, and as always, Thanks in Advance