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!!
--