After script.aculo.us v1.6, one can use the in-place editor and submit data onBlur without the need of buttons. The Javascript helper input_in_place_editor_tag ignores submitOnBlur, okButton, and cancelLink to accomplish onBlur editing. This is useful in applications similar to Google Spreadsheets.
The input_in_place_editor_tag should be allowed to be used like the following:
input_in_place_editor_tag('div_id', 'mymodule/myaction', array('cols'=> 4, 'rows' => 1, 'submitOnBlur' => 'true', 'okButton' => 'false', 'cancelLink' => 'false' )
Reference:
http://wiki.script.aculo.us/scriptaculous/show/Ajax.InPlaceEditor
Patch:
--- lib/symfony/helper/JavascriptHelper.php (revision 707)
+++ lib/symfony/helper/JavascriptHelper.php (working copy)
@@ -109,7 +109,7 @@
return tag('input', $html_options);
}
-
+
/**
* Returns an html button to a remote action defined by 'url' (using the
* 'url_for()' format) that's called in the background using XMLHttpRequest.
@@ -863,6 +863,18 @@
{
$js_options['loadTextURL'] = "'".$options['loadTextURL']."'";
}
+ if (isset($options['submitOnBlur']))
+ {
+ $js_options['submitOnBlur'] = $options['submitOnBlur'];
+ }
+ if (isset($options['okButton']))
+ {
+ $js_options['okButton'] = $options['okButton'];
+ }
+ if (isset($options['cancelLink']))
+ {
+ $js_options['cancelLink'] = $options['cancelLink'];
+ }
$javascript .= ', '._options_for_javascript($js_options);
$javascript .= ');';