[cgiapp] can't display and validate only in one run mode with CAP::Plugin::ValidateRM ?

Mark F azfuller at gmail.com
Thu Jun 16 15:07:26 EDT 2011


> On 06/14/2011 10:00 PM, silent wrote:
>> can I do displaying form and validate form only in one run mode ?
>>
>> # run mod
>> sub register {
>>      if ( GET request ) {
>>          #display form
>>      }elsif ( POST requst ) {
>>
>>         #validate
>>     }
>> }

I can see where your mind is going with this.

I've done something like that to handle executions without a runmode
(i.e., to keep the URL clean, and when the script is executed without
POST variables). But, I test for the submit button's value instead of
whether it was POST. I'll go through a lengthy test of all the
expected form submissions, and end by asking if there was no form
submission (no submit value). Inside that block I might determine if
it's a new visit or an internal link (based upon the referrer URL).

Best way to learn is to play with things the way you are. Sometimes
you learn more about how to do something by trying your own ideas like
that. You'll better appreciate why dispatch (or developing your own
path-based URLs and parsing them in setup) could be a solution for the
same problem.


More information about the cgiapp mailing list