Thank you, you made my day. I've added
with_    = "{username:value}"
and it works now, request.params["username"] contains the enterd
value.
I didn't really want to check the availability while typing (to much
data base traffic).

h.spinner() is my own function showing my busy spinner. Added it to lib
\helpers.py

def spinner():
    return tag("img", src="/images/spinner.gif", alt="")
+" "+_("Laden...")

Thank you very much for your help, I'm slowly getting into Python &
Pylons, I really like it.

/Martin


On Jul 11, 11:16 pm, "Jose Galvez" <[EMAIL PROTECTED]> wrote:
> You need to add two things:
> 1) you need to add frequency otherwise it will only update when you leave
> the field not wile you type within it,  Try setting the frequency to 1 sec
> or 0.5 sec
> 2) you need to add the with_ attribute with something like this
> with_="{myVariable:document.getElementById('field_id').value}"  that will
> stuff the variable "myVariable" in the the post with the value of the field
>
> Now for my question what does h.spinner do, I can't find any documentation
> on that one
> Jose
>
> On 7/11/07, mgratzer <[EMAIL PROTECTED]> wrote:
>
>
>
> > No Idea? Anyone?
>
> > On Jul 10, 11:15 am, mgratzer <[EMAIL PROTECTED]> wrote:
> > > Hello *,
> > > I'm new on Python and Pylons and playing around at the moment learning
> > > Pylons. I've a problem at the moment I need to solve and it seems to
> > > concern a bug.
>
> > > I'm using h.observe_field to check the availability of an newly
> > > entered user name on a registration form. The AJAX stuff is working
> > > well but the entered value on the observed field is not passed to the
> > > controller. request.params, request.GET and request.POST are empty.
> > > I've tried to add the with attribute and pass the parameter manually,
> > > same effect emty request.*. Am I doing something wrong? Or is it a
> > > bug? Here my View & Controller Code:
>
> > > View:
> > > # -*- coding: utf-8 -*-
> > > <%inherit file="/base/base.htm" />
> > > <%def name="title()">${_("Registrieren")}</%def>
> > > <h1>${_("Registrieren")}</h1>
> > > <fieldset>
> > >     <legend>${_("Registrieren")}</legend>
> > >         ${h.form(h.url_for(controller="login",action="signup"),
> > > method="post")}
> > >         <dl>
> > >             <dt><lable for="username">${_("Benutzername")}</lable></
> > > dt>
> > >             <dd>${h.text_field("username")}<div id="spinner"></
> > > div><small><div id="usercheck" class="error-message"></div></small></
> > > dd>
> > >             <dt><lable for="password">${_("Passwort")}</lable></dt>
> > >             <dd>${h.password_field("password")}</dd>
> > >             <dt><lable for="password_confirm">${_("Passwort")}</
> > > lable></dt>
> > >             <dd>${h.password_field("password_confirm")}</
> > > dd>
> > >             <dt><lable for="email">${_("E-Mail")}</lable></dt>
> > >             <dd>${h.text_field("email")}</dd>
> > >         <dl>
> > >         ${h.submit(_("Registrieren"))}
> > >         ${h.observe_field(field_id = "username",
> > >                           update   = "usercheck",
> > >                           url      =
> > > h.url_for(controller="login",action="usercheck",value="test"),
> > >                           complete = h.visual_effect("Highlight",
> > > "usercheck", duration=1),
> > >                           loading  =
> > > h.update_element_function("spinner", content=h.spinner()),
> > >                           loaded   =
> > > h.update_element_function("spinner", content="")
> > >                           )}
> > >         ${h.end_form()}
> > > </fieldset>
>
> > > Controller:
> > > ......
> > >     def usercheck(self):
> > >         user = model.User.get_by(login=request.params["username"])
> > >         if self._userexists(id):
> > >             return Response(_("user_is_in_use"))
> > >         else:
> > >             return Response("")
> > > ......


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to