Maybe try something simple and build on that.
For example, you could make simple form to submit the ref with a get
variable...
form = SQLFORM.factory(Field('ref',length=10,label='Test Ref'),
_method = 'GET',
_action=URL())
Then you can test to see whether the variable has been received: if
request.get_vars.ref
If so, find the record and make a normal SQLFORM to display it.
Hope it gives you an idea.
Regards, David
On Monday, August 27, 2012 11:16:11 AM UTC+1, Fred Kornyev wrote:
>
> Hello, we have a small issue with trying to pass an argument/variable to
> one of our function. It seems the solution should be simple, but we just
> can't figure it out!
>
> The idea is simple: we have an input field for a userID and when you
> submit is would pull data with the users other attributes (job title, team
> name, etc). We would like the SQLFORM to appear below the submit section
> when a valid username is entered. We tried all sorts of methods with LOAD,
> the built-in ajax function and the component 'part' of the A helper...
>
> so our view looks like this:
>
> {{extend 'layout.html'}}
> <script>
> jQuery(document).ready(function(){
> jQuery('#button').click(function(){
> ajax("{{=URL(c='ajax',f='ldap_fill.load')}}",['name'],'placeholder');
> return False;
> });
> });
> </script>
>
> <form><input name="name" id='name'></form>
> {{=A('CLICK HERE', _id="button", component=URL('ajax', 'ldap_fill.load',
> args=['name']), target='placeholder')}}
> <div id='placeholder'></div>
>
> There are two attempted solutions, but they don't work out:
> 1. With the jQuery on the top the SQLFORM that is returned by our
> ldap_fill function simply does not appear in the placeholder.
> 2. If we use the component of the A helper we can't figure out how to pass
> the contents of the input field as an argument. If I hardcode my username
> there then it brings up the SQLFORM filled with my details and when I
> submit it adds the entry to our app's database.
>
> So we just need a solution on how to have an input field and only show the
> SQLFORM below when a username is submitted.
> Thanks for anyone's time in advance!!
>
--