Wednesday, November 2, 2011

Re: Calling Python from JavaScript

You could call the Dajaxice method that gets the result (the one that fires when the drop down changes) with window.onload, or you could pass the initial values to the template via the view. For consistency and code reuse, I would personally use the first method, calling the Dajaxice function responsible for calculating the result with window.onload. If the method is currently accepting the drop-down's value as an argument, you would have to change it to actively find the selected values of the drop-downs manually from the javascript function.

Furbeenator

On Wed, Nov 2, 2011 at 2:31 AM, asif <saluasif@gmail.com> wrote:
I will explain what i'm trying to achieve, I'm using Dajaxice with
Django.

I created modelformset which consist of multiple forms. Each form has
dropdown field on which I'm calling dajaxice function, that function
will takes the value of the dropdown field and calls another python
function which calculates the total sum of all the values of dropdown
fields. Here my formset has initial values. So I want to call that
python function (which calculates result ) in javascript code (This
javascript function is for dajaxice )


Regards

Asif

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment