[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [cgiapp] run_modes problem


Stephen Lim <suppressed> wrote:
: 
: Somehow, the run_modes in setup() method doesn't
: pick up the correct run_mode as specified in the
: URL. My setup() method is as below :
: 
: sub setup {
:    my $self = shift;
:    $self->start_mode('displayForm');
:    $self->mode_param('rm');
:    $self->run_modes(
:      'displayForm' => 'DisplayRegistrationForm',
:      'registerUser' => 'RegisterNewUser'
:    );
: }
: 
: And my HTML form is as below :
: <form name="registrationForm" method="post" 
: action="/cgi-bin/registration.cgi?rm=registerNewUser">

    Shouldn't that be "registerUser" not
"registerNewUser".


:     ..... some stuff
: <input type="submit" value="Register" name="submitButton" />
: </form>
: 
: Somehow, when I tried to click the submit button, it still 
: run the displayRegistrationForm() method rather than 
: registerNewUser() method, although in the URL, it is clearly 
: displayed :
: http://..../cgi-bin/registration.cgi?rm=registerNewuser
: 
: Any idea where have I gone wrong ?

    Though the RFC says we are is supposed to
catch "get" and "post" simultaneously, it is
probably not a good habit to trust this. Add
a hidden variable and your problem should be
fixed.


<form
    name="registrationForm"
    method="post"
    action="/cgi-bin/registration.cgi">

    ..... some stuff

    <input type="submit" value="Register" name="submitButton" />
    <input type="hidden" name="rm" value="registerUser" />
</form>

HTH,

Charles K. Clarkson
-- 
Head Bottle Washer,
Clarkson Energy Homes, Inc.
Mobile Home Specialists
254 968-8328








---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/suppressed/
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.