A quick n00b question


Hi,

A quick question!

When I pass an array as an argument with $c_obj function, in the called server method, what is the 
type of argument received?

I see that sentence was badly framed, so the example,

If I have something like,
    $c_obj(‘Plot Control’,‘get_monthwise_amount’,[this.sel_fy.value,val2],callback);

and the server method called is defined as,
   def get_monthwise_amount(self,arg):

What is the type of parameter arg here?

I thought it should be a list or something, but it looks like its a string! Is this an expected behavior? Or am I doing something wrong?
Parsing string back to a list also seems to be a pain, it also includes the characters ‘[’, ‘"’ etc!!

Is parsing the string back is all what I have to do, or am I missing something else?

Thanks,



You received this message because you are subscribed to the Google Groups “ERPNext Technical Forum” group.

To view this discussion on the web visit https://groups.google.com/d/msg/wnframework/-/9YBmf3JiBHIJ.

To post to this group, send email to wn...@googlegroups.com.

To unsubscribe from this group, send email to wnframework+un...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/wnframework?hl=en.

Hi Dev,

There are 2 parts of the js code one inside the "legacy" folder. The $c family of methods part of the legacy. the new way is to use wn.call({method:, args:, callback:})

(do a grep to find use cases)

on server side you will get your parameters in webnotes.form_dict

for $c_obj, 

use json.loads(arg) to get back the dict

best,
Rushabh



-----------------------------------------------------
ERPNext - Business Operating System

W: https://erpnext.com
T: @rushabh_mehta

On 13-Mar-2012, at 4:58 PM, Dev wrote:


Hi,

A quick question!

When I pass an array as an argument with $c_obj function, in the called server method, what is the 
type of argument received?

I see that sentence was badly framed, so the example,

If I have something like,
    $c_obj('Plot Control','get_monthwise_amount',[this.sel_fy.value,val2],callback);

and the server method called is defined as,
   def get_monthwise_amount(self,arg):

What is the type of parameter arg here?

I thought it should be a list or something, but it looks like its a string! Is this an expected behavior? Or am I doing something wrong?
Parsing string back to a list also seems to be a pain, it also includes the characters '[', '"' etc!!

Is parsing the string back is all what I have to do, or am I missing something else?

Thanks,



You received this message because you are subscribed to the Google Groups “ERPNext Technical Forum” group.

To view this discussion on the web visit https://groups.google.com/d/msg/wnframework/-/9YBmf3JiBHIJ.

To post to this group, send email to wn…@googlegroups.com.

To unsubscribe from this group, send email to wnframework+un…@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/wnframework?hl=en.




You received this message because you are subscribed to the Google Groups “ERPNext Technical Forum” group.

To post to this group, send email to wn...@googlegroups.com.

To unsubscribe from this group, send email to wnframework+un...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/wnframework?hl=en.


That explains, thanks!

On Tue, Mar 13, 2012 at 5:02 PM, Rushabh Mehta <rm...@gmail.com> wrote:
Hi Dev,

There are 2 parts of the js code one inside the "legacy" folder. The $c family of methods part of the legacy. the new way is to use wn.call({method:, args:, callback:})

(do a grep to find use cases)

on server side you will get your parameters in webnotes.form_dict

for $c_obj,

use json.loads(arg) to get back the dict

best,
Rushabh



-----------------------------------------------------
ERPNext - Business Operating System

W: https://erpnext.com
T: @rushabh_mehta

On 13-Mar-2012, at 4:58 PM, Dev wrote:


Hi,

A quick question!

When I pass an array as an argument with $c_obj function, in the called server method, what is the
type of argument received?

I see that sentence was badly framed, so the example,

If I have something like,
$c_obj('Plot Control','get_monthwise_amount',[this.sel_fy.value,val2],callback);

and the server method called is defined as,
def get_monthwise_amount(self,arg):

What is the type of parameter arg here?

I thought it should be a list or something, but it looks like its a string! Is this an expected behavior? Or am I doing something wrong?
Parsing string back to a list also seems to be a pain, it also includes the characters '[', '"' etc!!

Is parsing the string back is all what I have to do, or am I missing something else?

Thanks,



You received this message because you are subscribed to the Google Groups "ERPNext Technical Forum" group.

To view this discussion on the web visit https://groups.google.com/d/msg/wnframework/-/9YBmf3JiBHIJ.

To post to this group, send email to wn…@googlegroups.com.

To unsubscribe from this group, send email to wnframework+un…@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/wnframework?hl=en.




You received this message because you are subscribed to the Google Groups "ERPNext Technical Forum" group.

To post to this group, send email to wn…@googlegroups.com.

To unsubscribe from this group, send email to wnframework+un…@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/wnframework?hl=en.




--
Regards,

Sudev.

Mob: +91 80 1010 8033
Phone: +91 11 4266 5226

su...@gmail.com




You received this message because you are subscribed to the Google Groups “ERPNext Technical Forum” group.

To post to this group, send email to wn...@googlegroups.com.

To unsubscribe from this group, send email to wnframework+un...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/wnframework?hl=en.