Hi Tom,

Tom Jefferson wrote:
> Thanks for the reply Joe. Yes I do have the Mason book, in fact it is the 
> very example you point out that made me doubt myself, submiting from 
> login.html to login_submit.html.
>  
> Seeing this I thought perhaps to keep in best practices with Mason I would 
> need 2 pages for all forms, one to collect the data and another to submit to 
> and process. It just seemed like a complicated process especially if I need 
> to then redirect to the first page to point out errors in the form.
>  
> I think I handle my site login similiar to the way you do. I handle Auth and 
> session info with the PerlHandler and redirect to the requested page once the 
> user has successfully authenticated.
>  
> I'm glad to hear I'm not breaking any cardnial rules with Mason, I live in a 
> bubble around here, I don't have any people I can bounce these questions off 
> of other than the Internet :).
>  
> If I understand you OK then I will keep POSTing directly to my pages that 
> required form data to be entered and perform validation on the same page.
>  
> I have the basic framework of the site completed and operational and I just 
> didn't want to spend all of this time writing the meat of the site only to 
> discover I went about it wrong.
>   


I'm curious about what you're doing and maybe I have been 
misunderstanding HTML/Mason...perhaps you or someone else can correct 
me.  In your example (abbreviated), you have:

<html>
...
</html>
<%init>
</%init>

Is this all one file or two?

If one, then perhaps I have been misunderstanding something about Mason, 
but I thought that the init block would be run by the web server/ModPerl 
first (interpreted), and then the web page would be sent to the client.  
i.e., the e-mail address variables are checked before the user has a 
chance to enter anything.  After the e-mail address is entered, it can't 
be checked again (likewise, if you "View Source" in your web browser, 
nothing from that <%init> block is there since it has been interpreted 
by ModPerl and effectively "gone".  So, it is never useful.)

What I am doing is still similar:  two HTML files.  login.html has the 
actual form and that gets submitted to another file called (say) 
login_submit.html which validates what was entered.  If something is 
wrong, it actually prints an error message, but I could make it send the 
input data back to login.html and show it to the user (with errors 
highlighted in red).  To reduce submissions to the server, I also use 
Javascript to do client-side validation.

What I'm doing works well enough...I didn't think you could use Mason to 
do form validation in the same file (I validate in login_submit.html).

Ray






-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to