Is it possible to combine ajaxuserexist() functionality (check
username on the fly) with {{=form.custom.widget.username}} in
registration form?
Best regards.
On 1 Lip, 23:27, mdipierro wrote:
> Thank you for letting us know. It is always good to report and discuss
> a problem even if it turns
Thank you for letting us know. It is always good to report and discuss
a problem even if it turns out to be nothing because some times it is
not nothing and something needs to be fixed.
Massimo
On 1 Lug, 13:08, elfuego1 wrote:
> Finally! Happy news.
> I have found an error. It was my fault.
>
>
Finally! Happy news.
I have found an error. It was my fault.
In db.py I had defined mysql database connection... TWICE.
Once for auth_user table and second time for all the other tables I
added myself.
So in administration panel I had seen only the tables I had added
myself and none of auth_ table
\applications\\myapplication/controllers/default.py", line 64, in
ajaxuserexist\n File "gluon/sql.py", line 1329, in __getattr__
\nKeyError: \'auth_user\'\n'
What is in default.py line 60-70?
I think it tells that db.auth_user is not defined. Something is wrong
in the models then.
On 30 Giu, 1
OK. Now I can see an error:
POST http://127.0.0.1:8000/myapplication/default/ajaxuserexist 500
INTERNAL SERVER ERROR
There is also information about issued ticet but I can't open it in
web browser, so I paste it below:
(dp1
S'output'
p2
S''
sS'layer'
p3
S'F:\\Programy\\web2py\\applications\\mya
I'd like to know if the console reports any error when the ajax
request is executed.
On 30 Giu, 15:31, elfuego1 wrote:
> I have firebug installed. What do you want me to look for?
> You want to see some firebug output?
>
> On 30 Cze, 22:25, mdipierro wrote:
>
> > I do not see anything wrong in t
I have firebug installed. What do you want me to look for?
You want to see some firebug output?
On 30 Cze, 22:25, mdipierro wrote:
> I do not see anything wrong in this. Do you use firebug?
>
> On 30 Giu, 15:18, elfuego1 wrote:
>
> > I hope I don't make your eyes bleed by puting all the code h
I do not see anything wrong in this. Do you use firebug?
On 30 Giu, 15:18, elfuego1 wrote:
> I hope I don't make your eyes bleed by puting all the code here but
> there is no other way to show it to you.
> I made change only in one place of the code to gather "login" value:
> {login:value}
> Oryg
I hope I don't make your eyes bleed by puting all the code here but
there is no other way to show it to you.
I made change only in one place of the code to gather "login" value:
{login:value}
Oryginaly it was: {name:value}.
$.post("{{=URL(r=request,c='default',f='ajaxuserexist')}}",
{login:value}
This should give you an error because the print(username) is outside
the funciton the function that defines username, after the function
returns. How are you passing the username to the ajax call? Did you
check with firebug that is calls the correct url?
On 30 Giu, 15:01, elfuego1 wrote:
> Ther
There was NO error messages. The code just didn't work.
After inserting:
print repr(username) to default.py I got:
# -*- coding: utf-8 -*-
#
## This is a samples controller
## - index is the default action of any application
You can simplify it a bit
def ajaxuserexist():
username = request.vars.values()[0]
return db(db.auth_user.login==username).count() and 'yes' or
'no'
although it will not solve your problem.
There is nothing special in table auth_user so the problem is
somewhere else.
I suggest you i
During registration I want to check on the fly, if login chosen by the
user is already in use or is it not in db and available to be used.
def ajaxuserexist():
username = request.vars.values()[0]
query = (db.auth_user.login==username)
numres = db(query).count()
if numres > 0 :
Probably a dumb question, but what are you checking the user against?
Both my and your example above are checking for username and you
didn't define a username in your auth_user.
Your query then is not working as:
def userexist(emailcheck):
if db(db.auth_user.email==emailcheck).count() > 0:
auth.define_tables() is there as well but bellow auth_user table
definition.
On 30 Cze, 20:59, Chris S wrote:
> And you've defined auth in db.py with:
>
> from gluon.tools import Auth
> auth = Auth(globals(), db)
> auth.define_tables()
>
> I've done searches on auth_user before... I think.
>
>
Since I had added some fields (and intend to customize it further) to
my auth_user table the code for auth_user in db.py looks like that:
from gluon.tools import *
auth=Auth(globals(),db)
db.define_table('auth_user',
SQLField('login', 'string', length=50, default=''),
SQLField('password',
And you've defined auth in db.py with:
from gluon.tools import Auth
auth = Auth(globals(), db)
auth.define_tables()
I've done searches on auth_user before... I think.
On Jun 30, 1:44 pm, elfuego1 wrote:
> Unfortunatelly it doesn't.
> I can access any other table that's available through my appl
Unfortunatelly it doesn't.
I can access any other table that's available through my application
but I can't get any value out of auth_user table.
Is it somehow protected?
Do I need to add some extra piece of code to expose them in my
application in order to be able to acqiure any value out of them?
I don't guess I follow. Isn't that the same as:
def userexist(namecheck):
if db(db.auth_user.username==namecheck).count() > 0:
return 'yes'
else:
return 'no'
So I"m saying your querry should be:
query = (db.auth_user.username==username)
Hope that helps
On Jun 29, 5:34 p
19 matches
Mail list logo