I am building my code on this idea.
Here, it is not accepting "web2py_component" in javascript.
[CODE]
function editURL( depId, depNm){
var urlTarget = "{{=URL('frmDeptEdt')}}";
{{web2py_component(urlTarget+"/"+depId+"/"+depNum, 'deptEdt')}};
jQuery( "#deptEdt" ).dialog('open');
}
[/CODE]
NameError: name 'web2py_component' is not defined
Whether any import is required for this?
I also tried {{= and "{{
---Vineet
On Oct 3, 6:12 pm, juanduke <[email protected]> wrote:
> Hi vineet:
>
> If I understanding what you want, my first idea to solve it is:
>
> <td>
> <!-- define an A() and _onClick call a custom js function
> editURL("department['deptid'],department['deptnm']")
> -->
> </td>
>
> then
> // assuming that you already defined the jquery ui dialog
> ( $("#deptEdt").dialog({ ... }); ) this piece of code shoul be written in
> jQuery(document).ready
>
> <script>
> function editURL( depId, depNm){
> var urlTarget = "/yourApp/yourController/yourFunctionToEditURL"
> // here call jQuery.load or web2py_component, both recive: urlTarget
> and a DIV id (i.e. <div id="deptEdt" />
> jQuery("#deptEdt").load(urlTarget,{deptid:depId, depnm:depNm},function()
> {
> jQuery('#deptEdt').dialog('open');
> });
> //or
> web2py_component(urlTarget+"/"+depId+"/"+depNum, 'deptEdt');
> // both way the result will be droped in #deptEdt div. You can check
> this with firebug or similar tool
> // finally show the dialog:
> jQuery( "#deptEdt" ).dialog('open');}
>
> </script>
>
> I hope to be clear, and again, sorry for my bad english.
> The web2py_component is very usefull if you will load a form that will be
> submited
>
> You could read about jQuery.load [jQuery.com] and web2py_component[web2py
> book] functions to clarify my "code"
>
> HTH
>
> Bye