[web2py] Re: Auto populate form
thank you all... i'll try your suggestions (need to do study javascript/ajax..) --
[web2py] Re: Auto populate form
or use a computed field ? On Tuesday, January 8, 2013 7:24:36 PM UTC+1, Derek wrote: > > You'd probably want to have a javascript that calls a special function on > your controller that returns the results from gethostbyname(). > > On Tuesday, January 8, 2013 10:46:04 AM UTC-7, Saba wrote: >> >> hello, >> >> I have a table like this: >> >> db.define_table('host', >> Field('host_name', requires=IS_NOT_EMPTY()), >> Field('host_ip', requires=IS_NOT_EMPTY()) >> ) >> >> i'm using SQLFORM.grid to display/edit the data in the table. When a user >> inputs a host_name field, I would like to automatically populate the >> host_ip field by doing an nslookup of the host_name. Is there a way to do >> this. Any suggestions please? >> >> thanks, >> Saba >> >> > --
[web2py] Re: Auto populate form
You'd probably want to have a javascript that calls a special function on your controller that returns the results from gethostbyname(). On Tuesday, January 8, 2013 10:46:04 AM UTC-7, Saba wrote: > > hello, > > I have a table like this: > > db.define_table('host', > Field('host_name', requires=IS_NOT_EMPTY()), > Field('host_ip', requires=IS_NOT_EMPTY()) > ) > > i'm using SQLFORM.grid to display/edit the data in the table. When a user > inputs a host_name field, I would like to automatically populate the > host_ip field by doing an nslookup of the host_name. Is there a way to do > this. Any suggestions please? > > thanks, > Saba > > --
[web2py] Re: Auto populate form
I'd just add javascript to the view to do it. Attach to the change event on the name field and do ajax requests from the server for dns resolution. If successful fill in the host_ip field. Terça-feira, 8 de Janeiro de 2013 17:46:04 UTC, Saba escreveu: > > hello, > > I have a table like this: > > db.define_table('host', > Field('host_name', requires=IS_NOT_EMPTY()), > Field('host_ip', requires=IS_NOT_EMPTY()) > ) > > i'm using SQLFORM.grid to display/edit the data in the table. When a user > inputs a host_name field, I would like to automatically populate the > host_ip field by doing an nslookup of the host_name. Is there a way to do > this. Any suggestions please? > > thanks, > Saba > > --