If I do understand you correct: you want to have in the same modal form:

   - if the user is logged in: a form for submitting a new Post;
   - if the user is not logged in: a login form.

Is that correct?

On Thursday, 18 February 2016 23:22:19 UTC+1, Ron Chatterjee wrote:
>
> Here in the picture I explained. Once I click on the button, I do display 
> the form in my modal. But that display inside the modal can only be if the 
> user signed in or the request to sign in. If I could do something like this.
>
> def process_form():
>
>        form = SQLFORM(db.post).process()
> return locals()
>
> Then I could use @auth.requires_login() on the top of the def. If I do 
> that, then I will need to use load inside myfunction which I don't want to. 
> May be I need to think more..lol
>
>
> On Thursday, February 18, 2016 at 4:04:28 PM UTC-5, Anthony wrote:
>>
>> On Thursday, February 18, 2016 at 3:58:08 PM UTC-5, Ron Chatterjee wrote:
>>>
>>> Yes. Or if there is a way to add @auth.requires_login() to the table 
>>> itself. In other words, SQLFORM will validate if the user is logged in or 
>>> not based on that flag. like requires=IS_NOT_EMPTY(). Similar to that 
>>> requires = IS_LOGGED_IN(). But there isn't anything like that. lol. So, 
>>> yes, I need to work around.
>>>
>>
>> The point is, you want to check for login *before* presenting the form. 
>> In any case, it's trivially easy to add code to check for login before 
>> showing a form, so I don't think it would be all that helpful to build that 
>> functionality into SQLFORM.
>>
>> 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.

Reply via email to