> {{block page_js}}
> <script>
> jQuery("#web2py_user_form input:visible:enabled:first").focus();
> {{if request.args(0)=='register':}}
> web2py_validate_entropy(jQuery('#auth_user_password'),100);
> {{elif request.args(0)=='change_password':}}
> web2py_validate_entropy(jQuery('#no_table_new_password'),100);
> {{pass}}
> </script>
> {{end page_js}}
>
>
> what are the {block page_js} / {end page_js} instructions for ?
>
http://web2py.com/books/default/chapter/29/05/the-views#Blocks-in-views
> the script mixes javascript and python expressions. How does javascript
> understand python ? Is this documented in the web2py book ?
>
See http://web2py.com/books/default/chapter/29/05/the-views#The-views for
an explanation of how the views work. Everything inside the {{...}}
delimiters is executed as Python code. Each line or fragment that is
outside of the delimiters is considered a string literal to be written
directly to the response body (by wrapping it in response.write()). So, the
Python code in the view gets executed on the server. The resulting HTML is
then sent to the browser, and the Javascript that was written into the HTML
gets executed in the browser.
Anthony
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.