Ajax-problem with grok

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

Ajax-problem with grok

This post has NOT been accepted by the mailing list yet.
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 False,
    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-type", "application/x-www-form-urlencoded");
      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;