Development

#2176 (Javascript helper's input_in_place_editor_tag doesn't allow editing without buttons [patch])

You must first sign up to be able to contribute.

Ticket #2176 (closed defect: fixed)

Opened 3 years ago

Last modified 2 years ago

Javascript helper's input_in_place_editor_tag doesn't allow editing without buttons [patch]

Reported by: Isaac.Saldana Assigned to: FabianLange
Priority: minor Milestone: 1.1.0
Component: helpers Version: 1.1.0 DEV
Keywords: Cc:
Qualification: Accepted

Description

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 .= ');';

Change History

03/10/08 22:38:31 changed by FabianLange

  • owner changed from fabien to FabianLange.
  • status changed from new to assigned.
  • version changed from 1.0.6 to 1.1.0.
  • qualification set to Accepted.
  • milestone set to 1.1.0.

I will add this feature with the scriptaculous upgrade in 1.1. it will use the new IPE api: http://mir.aculo.us/2007/7/17/in-place-editing-the-summer-2007-rewrite

03/11/08 12:23:17 changed by FabianLange

okay, once i commit and close this ticket you can do in symfony 1.1 this

input_in_place_editor_tag('div_id', 'ajax1/index', array('cols'=> 4, 'rows' => 1, 'submitOnBlur' => 'true', 'okControl' => false, 'cancelControl' => false ))

03/13/08 10:18:58 changed by FabianLange

  • status changed from assigned to closed.
  • resolution set to fixed.

as with r7855 the in place editor will now pass through options as you pass them into. only some special cases have been preserved for backwards compatibility.

input_in_place_editor_tag('div_id', 'mymodule/myaction', array('cols'=> 4, 'rows' => 1, 'submitOnBlur' => true, 'okControl' => false, 'cancelControl' => false ))

works now

The Sensio Labs Network

Since 1998, Sensio Labs has been promoting the Open-Source software movement by providing quality web application development, training, consulting.
Sensio Labs also supports several large Open-Source projects.