/**
* Returns a JavaScript snippet to be used on the AJAX callbacks for starting visual effects.
* @param string type(show, hide, effect, toggle)
* @param string name (blind, clip, drop, explode, fold, puff, slide, scale, pulsate) (bounce, highlight, shake, transfer)
* @param string element_id name value of dom element
* @param array js_options options for the selected effect
* @param string speed value for the effect's speed
*
* Example:
* <?php echo jq_link_to_function('Reload', array(
* 'update' => 'posts',
* 'url' => '@reload',
* 'complete => jq_visual_effect('toggle', 'blind', 'posts', array('direction' => 'vertical' ), 'normal'),
* )) ?>
*
* If no '$element_id' is given, it assumes "element" which should be a local
* variable in the generated JavaScript execution context. This can be used
* for example with drop_receiving_element():
*
* <?php echo jq_drop_receving_element( ..., array(
* ...
* 'loading' => jq_visual_effect('fade'),
* )) ?>
*
* This would fade the element that was dropped on the drop receiving element.
*
* You can change the behaviour with various options, see
* http://http://docs.jquery.com/UI/ for more documentation.
*/
function jq_visual_effect($type, $name, $element_id = false, $js_options = array(), $speed = "slow")
{
$response = sfContext::getInstance()->getResponse();
$response->addJavascript(sfConfig::get('app_sfJQueryPlugin_ui_folder', 'jq').'/jquery-ui');
$element = $element_id ? "$('#$element_id')" : 'this';
return "$element.$type('$name', "._jq_options_for_javascript($js_options).", '$speed');";
}
/**
* wrapper for jquery autocompleter.
* @param string name value of input field
* @param string default value for the input field
* @param string url to server script
* @param array input tag options. (size, autocomplete, etc...)
* @param array completion options. (use_style, etc...)
*
* @return string input field tag, div for completion results, and
* auto complete javascript tags
*/
function jq_input_auto_complete_tag($name, $value, $url, $tag_options = array(), $completion_options = array())
{
$context = sfContext::getInstance();
$tag_options = _convert_options($tag_options);
$response = sfContext::getInstance()->getResponse();
$response->addJavascript(sfConfig::get('app_sfJQueryPlugin_ui_folder', 'jq').'/jquery-autocomplete');
//$comp_options = _convert_options($completion_options);
if (isset($comp_options['use_style']) && $comp_options['use_style'] == true)
{
$response->addStylesheet(sfConfig::get('sf_prototype_web_dir').'/css/input_auto_complete_tag');
}
$tag_options['id'] = get_id_from_name(isset($tag_options['id']) ? $tag_options['id'] : $name);
$javascript = input_tag($name, $value, $tag_options);
$javascript .= jq_javascript_tag("$('#".$name."').autocomplete('$url', "._jq_options_for_javascript($completion_options).");");
return $javascript;
}
simo wrote: Fourat is not anymore into the plugin development.
He told me we can do anything with this plugin.
ACtually, we should organise ourselves and commit the plugin into the svn ....
any volunteer?
jjoaco wrote: hi everyone, i wrote the method jq_observe_field some months ago....
few days ago, i asked for contribute but for now, i don't have answers from plugin's lead.
_Andreas_ wrote: Hello jjoaco,jjoaco wrote on Wed, 27 August 2008 19:45 wrote: hi everyone, i wrote the method jq_observe_field some months ago....
few days ago, i asked for contribute but for now, i don't have answers from plugin's lead.
it would be very nice if you could share your ''jq_observe_field''~
~
![]()
@simo, mcaleau: Thank you very much for you work!
Greetings from Austria
Andreas
function jq_observe_field($name, $options = array())
{
if (isset($options['with']))
{
$options['with'] .= "+'&'+$('#".$name."').attr('id')+'='+$('#".$name."').val()";
}
else
{
$options['with'] = "$('#".$name."').attr('id')+'='+$('#".$name."').val()";
}
return jq_javascript_tag("$('#".$name."').change(function(){".jq_remote_function($options).";});" ;);
}
<?php echo jq_observe_field('sucursal_id', array(
'update' => 'departament_id',
'url' => 'module/action',
)) ?>
<?php echo jq_observe_field('departament_id', array(
'update' => 'document_id',
'url' => 'module/action',
'with' => "'suc_id='+$('#suc_id').val()"
)) ?>
Error: illegal character
Sourcefile: http://localhost/frontend_dev.php/iceMenuPages/show/ice_menu_id/53
Row: 214, Column: 86
Sourcecode:
$('#sucursal_id').change(function()
{jQuery.ajax({type:'POST',dataType:'html',data:'$('#sucursal_id').attr('id')+'='+$('#sucursal_id').val()',success:function(data, textStatus)
{jQuery('#departament_id').html(data);},url:'/frontend_dev.php/module/action'});elseif (isset($options['with'])) $formData = '\''.$options['with'].'\''; elseif (isset($options['with'])) $formData = $options['with'];elseif (isset($options['with'])) $formData = '\''.$options['with'].'\'';simo wrote: guys, which version are you working with?
JoeZ99 wrote: Just for you to know.
Thanks to boutell, the issue with the "with" parameter is already fixed. quotes are removed, so now it works passing javascript evaluable strings and everybody happy!
/**
* wrapper for jquery dialog.
* @param string element id of dialog content element
* @param array options (bgiframe: true requires jQuery bgiframe plugin
* @param array optional element id to open the dialog if an user clicks on this element
*
* @return string jQuery dialog call
*
* Example:
* <div id="myDialog" title="My jQuery Dialog">I'm in the dialog</div>
* <span id="showMyDialog" style="text-decoration: underline; cursor: pointer;">Click me to open dialog</span>
* <?php echo jq_dialog('myDialog', array(
* 'autoOpen' => 'false',
* 'modal' => 'true',
* 'bgiframe' => 'true',
* 'position' => '\'center\'',
* 'resizable' => 'false',
* 'width' => '640',
* 'maxWidth' => '640',
* 'height' => '480',
* 'maxHeight' => '480'
* ),
* 'showMyDialog'
* );
* ?>
*/
function jq_dialog($element_id, $options = array(), $open_element_id = '')
{
$response = sfContext::getInstance()->getResponse();
$response->addJavascript(sfConfig::get('sf_jquery_web_dir', '/sfJqueryReloadedPlugin/js/jquery-ui.min.js').'js/jquery-ui.min.js');
$response->addStyleSheet(sfConfig::get('sf_jquery_web_dir', '/sfJqueryReloadedPlugin/css/jquery-ui.css').'css/jquery-ui.css');
if (isset($options['bgiframe']))
{
$response->addJavascript(sfConfig::get('sf_jquery_web_dir', '/sfJqueryReloadedPlugin/js/jquery.bgiframe.min.js').'js/jquery.bgiframe.min.js');
}
$openDialog = (empty($open_element_id)) ? '' : "; $('#$open_element_id').click(function(){\$('#$element_id').dialog('open');})";
return jq_javascript_tag("$(document).ready(function(){jQuery('#$element_id').dialog("._jq_options_for_javascript($options).")".$openDialog."});");
}'success' => "updateJSON(data,'abo_sub_contact_id');".jq_visual_effect('blind','abo_sub_contact_id'), public function getJavascripts()
{
return array(
'jquery/jquery-1.3.2.min.js',
'jquery/ui/js/jquery-ui-1.7.2.custom.min.js',
'/sfFormExtraPlugin/js/jquery.autocompleter.js',
);
}'success' => "updateJSON(data,'abo_sub_contact_id');".jq_visual_effect('highlight','abo_sub_contact_id'),jQuery("abo_sub_contact_id").highlight is not a functionJackJones wrote: Yes FadeIn will work.
I will create a ticket for this Feature Request.
Any idea, why this is not implementated?
Users browsing this forum: No registered users and 1 guest