Would web2py's built-in ajax() function work for
you: http://web2py.com/book/default/chapter/10#The-ajax-Function? Maybe
something like:
<select id="mail_subject" onchange="ajax({{=URL('get_mail_text'),
['mail_subject'], 'mail_text');">
Anthony
On Saturday, August 27, 2011 2:52:07 AM UTC-4, annet wrote:
>
> Hi Cliff,
>
> Thanks for your reply. I fear I wasn't clear enough. I read about
> the .change and .val functions, however, I couldn't figure out how to
> get from the JavaScript function to querying the database and back to
> the JavaScript function.
>
> I have the following view:
>
>
> {{extend 'admincms/layout.html'}}
>
> <div class="box">
> ...
> {{=form}}
> ...
> </div> <!-- box -->
> <script>
> jQuery(document).ready(function(){
> jQuery('#mail_subject').change(function(){
> subject=jQuery('#mail_subject').val();
> value=...
> jQuery.('mail_text').val(value);});
> });
> </script>
>
>
>
> Here ... based on subject the database should be queried for the
> corresponding text, which should then be put in the mail_text text
> area.
>
>
> Kind regards,
>
> Annet.