[web2py] Re: Reloading a component and passing variables to it

2014-01-17 Thread Anthony
Remember, everything inside {{...}} is rendered on the server before 
delivery to the browser, so you can't include JS in there. Instead, should 
be:

web2py_component({{=URL('pricing', 'priceListProduct.load')}} +
 ?priceListProductId= + priceListProductId,
 target='priceListProductEdit')

You have to add the query string entirely in JS, so you can't use the 
web2py URL() function for that part.

Anthony

On Friday, January 17, 2014 11:32:55 AM UTC-5, Jim S wrote:

 Trying to reload a component, passing new parameters to it.

 I have the following code based on this discussion:  
 https://groups.google.com/forum/#!searchin/web2py/reload$20component/web2py/jZeJT0WFgV4/x4eeOpAFxh8J

 script type=text/javascript
 function priceListProductSiteEdit( priceListProductId ) {
 //alert(priceListProductId);
 
 //$('#priceListProductEdit2').load('/infocenter/pricing/priceListProduct.load?priceListProductId='
  
 + priceListProductId);
 web2py_component({{=URL('pricing', 'priceListProduct.load', 
 vars={'priceListProductId': + priceListProductId + })}}, target=
 'priceListProductEdit');
 }
 /script


 But, when my controller function is called, the value passed to the 
 priceListProductId variable is  + priceListProductId + not the 
 value that is passed to the javascript function.

 I'm having a total brain-fart trying to figure out how to pass this 
 properly.

 Can someone help please?

 -Jim


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Reloading a component and passing variables to it

2014-01-17 Thread Jim S
Of course that is the answer Anthony!

For some reason I just wasn't able to come up with it today.  Thanks for 
laying things out clearly, as you always do.

Very much appreciated.

All the best

-Jim

On Friday, January 17, 2014 1:02:27 PM UTC-6, Anthony wrote:

 Remember, everything inside {{...}} is rendered on the server before 
 delivery to the browser, so you can't include JS in there. Instead, should 
 be:

 web2py_component({{=URL('pricing', 'priceListProduct.load')}} +
  ?priceListProductId= + priceListProductId,
  target='priceListProductEdit')

 You have to add the query string entirely in JS, so you can't use the 
 web2py URL() function for that part.

 Anthony

 On Friday, January 17, 2014 11:32:55 AM UTC-5, Jim S wrote:

 Trying to reload a component, passing new parameters to it.

 I have the following code based on this discussion:  
 https://groups.google.com/forum/#!searchin/web2py/reload$20component/web2py/jZeJT0WFgV4/x4eeOpAFxh8J

 script type=text/javascript
 function priceListProductSiteEdit( priceListProductId ) {
 //alert(priceListProductId);
 
 //$('#priceListProductEdit2').load('/infocenter/pricing/priceListProduct.load?priceListProductId='
  
 + priceListProductId);
 web2py_component({{=URL('pricing', 'priceListProduct.load', 
 vars={'priceListProductId': + priceListProductId + })}}, target=
 'priceListProductEdit');
 }
 /script


 But, when my controller function is called, the value passed to the 
 priceListProductId variable is  + priceListProductId + not the 
 value that is passed to the javascript function.

 I'm having a total brain-fart trying to figure out how to pass this 
 properly.

 Can someone help please?

 -Jim



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.