This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

remote_function with 2 parameters

Forum to discuss ExtJS and other JS plugins

remote_function with 2 parameters

by aznatam » Sun Oct 19, 2008 2:40 am

I need to pass two parameters two an action called with remote_function

Code: Select all
 <?php echo javascript_tag("function updateLunchSelection(){"." ".
         remote_function(array(
             'update'  => 'calendar',
             'url'     => 'guard/calendar',
             'with'    => "'month=' + \$F('month')", 
         )). " " .
         "}"
 
 ) ?>



but I need to pass the year also.

How you pass to parameter with 'with' :?~ :-?~ :???:
aznatam
Junior Member
 
Posts: 16
Joined: Mon Sep 22, 2008 6:16 am
Location: Chile

Re: remote_function with 2 parameters

by cokker » Sun Oct 19, 2008 7:31 pm

use &

greets
Sven
cokker
Faithful Member
 
Posts: 591
Joined: Mon Jan 15, 2007 10:43 am
Location: Germany

Re: remote_function with 2 parameters

by aznatam » Sun Oct 19, 2008 10:26 pm

Code: Select all
 <?php echo javascript_tag("function updateLunchSelection(){"." ".
         remote_function(array(
             'update'  => 'calendar',
             'url'     => 'guard/calendar',
             'with'    => "'month=' + \$F('month')"."'&year=' + \$F('year')", 
         )). " " .
         "}"
 
 ) ?>



That doesn't work, or do you mean otherwise
aznatam
Junior Member
 
Posts: 16
Joined: Mon Sep 22, 2008 6:16 am
Location: Chile

Re: remote_function with 2 parameters

by aznatam » Sun Oct 19, 2008 11:30 pm

Code: Select all
 <?php echo javascript_tag("function updateLunchSelection(){"." ".
         remote_function(array(
             'update'  => 'calendar',
             'url'     => 'guard/calendar',
             'with'    => "'month=' + \$F('month')"."'+&year=' + \$F('year')", 
         )). " " .
         "}"
 
 ) ?>


ok it' was with a +
aznatam
Junior Member
 
Posts: 16
Joined: Mon Sep 22, 2008 6:16 am
Location: Chile

Re: remote_function with 2 parameters

by atznt » Fri Jun 12, 2009 9:59 pm

Hi... Can you please tell me for what is \$F(??

'with' => "'month=' + \$F('month')"."'&year=' + \$F('year')",
atznt
Member
 
Posts: 32
Joined: Fri Feb 27, 2009 2:44 pm
Location: Norte de Santander/Colombia

Re: remote_function with 2 parameters

by aznatam » Sat Jun 13, 2009 5:04 am

Is a prototype method

$F
Returns the value of a form control. This is a convenience alias of Form.Element.getValue. Refer to it for full details.

I was using select_tag so I need it to get the value.

if you have the value you can use directly $(your_variable)
aznatam
Junior Member
 
Posts: 16
Joined: Mon Sep 22, 2008 6:16 am
Location: Chile

Re: remote_function with 2 parameters

by atznt » Sat Jun 13, 2009 6:06 pm

Ahh Thank you!
By the way, I'm using a select_tag, and I want to update the content of a div, but I must be filled with the content of the select_tag selection, do you know How Can I do that?

Code: Select all
<?php echo select_tag('careersubjects', objects_for_select($subjectsArray,'getCodeandname'), array(
       'onchange' =>
   update_element_function('hello', array(
  'content'  => ¿?,
))
)) ?>


<div id="hello">
THIS MUST BE REPLACED WITH THE SELECT_TAG SELECTION
</div>
atznt
Member
 
Posts: 32
Joined: Fri Feb 27, 2009 2:44 pm
Location: Norte de Santander/Colombia

Re: remote_function with 2 parameters

by aznatam » Sat Jun 13, 2009 6:30 pm

The way I make it is using remote function to another action and template.

<?php echo select_tag('careersubjects', objects_for_select($subjectsArray,'getCodeandname'),
array( 'onchange' => update_element() )
) ?>



<?php echo javascript_tag("function updateElement(){"." ".
remote_function(array(
'update' => 'Hello',
'url' => (the other template),
'with' => (parameters)
)). " " .
"}"
) ?>
aznatam
Junior Member
 
Posts: 16
Joined: Mon Sep 22, 2008 6:16 am
Location: Chile