Reply below

On Dec 1, 11:15 pm, Anthony <abasta...@gmail.com> wrote:
> When the form is submitted, your function first checks if the user is
> logged in -- if not, it never gets to the code that creates or processes
> the form, so of course it can't execute your onvalidation function. Also,

I think you just hit the nail. How can I intercept the process?

> 'onvalidation' should be a function, not a call to a function (i.e., just
> validate_session, not validate_session()).

I used validate_session initially and it gave me an error...
>> TypeError: validate_session() takes no arguments (1 given)
so I added the (), no error. *puzzled*

> Also, note that adding an "_onsubmit" attribute to SQLFORM will end up
> adding an "onsubmit" attribute to the HTML <form> tag, so the value of that
> attribute should be a Javascript string to be executed on the client side,
> not a Python function. In that case, it should trigger an Ajax callback to
> check login status, and the resulting behavior will have to be handled
> client side (either flashing the message or proceeding with submitting the
> form).

I used a simple Javascript function for this:
<script type="text/javascript">
<!--
function validate_session(){
  return false
}
//-->
</script>

It works when the user is logged in (nothing is submitted)
But it fails when the user session expires

Reply via email to