I don't think it possible to pass javascript variable to web2py like that,
it would be a big security hole if you can...

Not sure how it applies, but when I want to pass vars to component I just
call or redirect to URL with the appropriate vars that I want to pass to
the component from the master view/controller (the one in which there is
component embeded)...

Then, my component just have to pickup the vars with request.vars.var with
LOAD()... This can be does also with web2py_component() in javascript as
show above...

But maybe you have a different requirement that I don't understand because
you don't explained you use case nor showed code...

Richard


On Fri, Jan 17, 2014 at 12:26 PM, Jim S <j...@qlf.com> wrote:

> For example, when I call the reload using this method, it works:
>
> $('#priceListProductEdit2').load(
> '/infocenter/pricing/priceListProduct.load?priceListProductId=' 
> +priceListProductId
> );
>
>
> But am having trouble getting the javascript variable passed to the URL
> function call.
>
> -Jim
>
>
> On Friday, January 17, 2014 11:20:59 AM UTC-6, Jim S wrote:
>>
>> priceListProductId is an integer that is being passed into the javascript
>> function.  However, I don't know how to specify that on the
>> web2py_component call.  Trying to pass it to the 'vars' parameter but can't
>> get the syntax right.  It isn't in the request object in web2py yet.
>>
>> -Jim
>>
>> On Friday, January 17, 2014 10:43:31 AM UTC-6, Richard wrote:
>>>
>>> Hello Jim,
>>>
>>> what's in priceListProductId ?
>>>
>>> I would see this in javascript :
>>>
>>> priceListProductId = {{=request.vars.priceListProductId}}
>>>
>>> ?
>>>
>>> Richard
>>>
>>>
>>> On Fri, Jan 17, 2014 at 11:32 AM, Jim S <j...@qlf.com> 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+un...@googlegroups.com.
>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>
>>>
>>>  --
> 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.
>

-- 
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.

Reply via email to