[Grok-dev] Ajax-problem with grok

MarcelK battlefox at gmail.com
Tue Jan 17 12:33:31 UTC 2012

I got a problem within grok when I try to use a Ajax http-request.

This is what I do:

1. I have a render method on a view class called "set_invoice"
2. I have a form where I can choose "project" (form.project.group) &
"subroject (form.project.item)"
3. Once subproject is choosen, a onChange Event triggers the function below.
4. Within my render method, a validation is performed which return True or
    depending on the values of "form.project.group" and "form.project.item"
5. This is where my problem begins: Within my render method, I dont have the
     values of group & item (project & subproject) on my request, like I
expected in
     the old Zope2 days.

QUESTION: How can I pass those field-values to the python method? It seems
to be impossible
to pass them via url-params or via request, sicne the request
(self.request.form) within my
python-method remains empty no matter I try to change it. 

below the function Project_fkt() that is called with onChange + the doGet:

    this.doGet = function(params) {
      // make a HTTP GET request to the URL asynchronously
      req.open("POST", url, true);
      //Send the proper header information along with the request
      req.setRequestHeader("Content-length", params.length);
      req.setRequestHeader("Connection", "close");

function Project_fkt(item) {
    var url = './set_invoice'
    var ajax = new AJAXInteraction(url, validateCallback);
    var params = 'form.project.group=' +
document.getElementsByName('form.project.group')[0].value; +
'&form.project.item=' + item.value;

View this message in context: http://python.6.n6.nabble.com/Ajax-problem-with-grok-tp3680518p3680518.html
Sent from the Grok mailing list archive at Nabble.com.

More information about the Grok-dev mailing list