variables.fw.redirect() with message

906 views
Skip to first unread message

Jermy

unread,
Oct 7, 2010, 11:26:08 AM10/7/10
to framework-one
Hi List,

very simple question seems I am missing something here, i am not able
to show message when a user enter wrong username or password but the
request is redirecting to login.cfm. My endAuthentication function is
like-

<cffunction name="endAuthenticate">
<cfif rc.result> <!--- If success --->
<cfset variables.fw.redirect('login.home', 'all')>
<cfelse>
<cfset rc.message = 'Invalid Username or Password'/>
<cfset variables.fw.redirect('login.login', 'message') />
</cfif>
</cffunction>

-----------------------------------
login.cfm

<cfoutput>
<cfform name="login" id="login" method="post"
action="#buildURL('login.authenticate')#">
Username: <cfinput type="text" name="username" required="true"
message="Enter your Username" /><br>
Password:<cfinput type="password" name="password" required="true"
message="Enter your Password" /><br>
<cfinput type="submit" name="submit" value="Go Get In">
</cfform>
</cfoutput>




Thanks In Advance
-Jermy

Dan Vega

unread,
Oct 7, 2010, 11:27:30 AM10/7/10
to framew...@googlegroups.com
You are looking for preserve 

redirect(action="login.login",preserve="all");

all to preserve all variables or just the variables you want to preserve

redirect(action="login.login",preserve="message,error,success");

Sean Corfield

unread,
Oct 7, 2010, 11:39:27 AM10/7/10
to framew...@googlegroups.com
On Thu, Oct 7, 2010 at 8:26 AM, Jermy <jerm...@gmail.com> wrote:
>                <cfset rc.message = 'Invalid Username or Password'/>
>                <cfset variables.fw.redirect('login.login', 'message') />

That's fine. preserve is the second argument so it will preserve
rc.message across the redirect.

> login.cfm

I don't see #rc.message# in this file?
--
Sean A Corfield -- (904) 302-SEAN
Railo Technologies, Inc. -- http://getrailo.com/
An Architect's View -- http://corfield.org/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

Jermy

unread,
Oct 7, 2010, 12:52:33 PM10/7/10
to framework-one
OMG, I was doing the same and also seeing the desired output,

<cfoutput>
<cfparam name="rc.message" default="">
#rc.message#
</cfoutput>

but when I go thru userManagerAccessControl example, I did not see any
#rc.message# in login.default. oppss....I checked again its in
layout.default :(
Thats good idea to put error/success message in layouts.

Thanks Sean

-Jermy

<cfoutput>
<cfparam name="rc.message" default="">
#rc.message#
</cfoutput>



On Oct 7, 8:39 pm, Sean Corfield <seancorfi...@gmail.com> wrote:
> On Thu, Oct 7, 2010 at 8:26 AM, Jermy <jermy...@gmail.com> wrote:
> >                <cfset rc.message = 'Invalid Username or Password'/>
> >                <cfset variables.fw.redirect('login.login', 'message') />
>
> That's fine. preserve is the second argument so it will preserve
> rc.message across the redirect.
>
> > login.cfm
>
> I don't see #rc.message# in this file?
> --
> Sean A Corfield -- (904) 302-SEAN
> Railo Technologies, Inc. --http://getrailo.com/
> An Architect's View --http://corfield.org/

Dan Vega

unread,
Oct 7, 2010, 12:53:46 PM10/7/10
to framew...@googlegroups.com
ohh, why did i think preserve was the 3rd arg.. :(

sorry 

Jermy

unread,
Oct 7, 2010, 1:51:59 PM10/7/10
to framework-one
It's working only with #buildURL('login.authenticate')#, not with
action="index.cfm?login.authenticate".

Any clue...

Thanks,
-Jermy

On Oct 7, 9:53 pm, Dan Vega <danv...@gmail.com> wrote:
> ohh, why did i think preserve was the 3rd arg.. :(
>
> sorry
>
> Thank You
> Dan Vega
> danv...@gmail.comhttp://www.danvega.org/
> > FW/1 on Google Groups:http://groups.google.com/group/framework-one- Hide quoted text -
>
> - Show quoted text -

Sean Corfield

unread,
Oct 7, 2010, 2:11:57 PM10/7/10
to framew...@googlegroups.com
On Thu, Oct 7, 2010 at 10:51 AM, Jermy <jerm...@gmail.com> wrote:
> It's working only with #buildURL('login.authenticate')#, not with
> action="index.cfm?login.authenticate".

Not sure what you're asking... action="index.cfm?login.authenticate"
isn't legal. Did you mean action="login.authenticate"...?


--
Sean A Corfield -- (904) 302-SEAN

Railo Technologies, Inc. -- http://getrailo.com/
An Architect's View -- http://corfield.org/

Jermy

unread,
Oct 7, 2010, 2:24:05 PM10/7/10
to framework-one
My question is... Does <cfset variables.fw.redirect('login.login',
'message')/> works only when form action is
#buildURL('login.authenticate')# ?

It is not working when form action is action="index.cfm?
login.authenticate".
I never use action="login.authenticate" in my forms.


Thanks,
-Jermy

On Oct 7, 11:11 pm, Sean Corfield <seancorfi...@gmail.com> wrote:
> On Thu, Oct 7, 2010 at 10:51 AM, Jermy <jermy...@gmail.com> wrote:
> > It's working only with #buildURL('login.authenticate')#, not with
> > action="index.cfm?login.authenticate".
>
> Not sure what you're asking... action="index.cfm?login.authenticate"
> isn't legal. Did you mean action="login.authenticate"...?
> --
> Sean A Corfield -- (904) 302-SEAN
> Railo Technologies, Inc. --http://getrailo.com/
> An Architect's View --http://corfield.org/

Jermy

unread,
Oct 7, 2010, 2:30:34 PM10/7/10
to framework-one
Below are the 2 cases of login.login

<cfoutput>

<cfform name="login" id="login" method="post"
action="#buildURL('login.authenticate')#">
Username: <cfinput type="text" name="username" required="true"
message="Enter your Username" /><br>
Password:<cfinput type="password" name="password" required="true"
message="Enter your Password" /><br>
<cfinput type="submit" name="submit" value="Go Get In">
</cfform>
</cfoutput>
---------------------------
<cfoutput>
<cfform name="login" id="login" action="index.cfm?login.authenticate"
method="post">
Username: <cfinput type="text" name="username" required="true"
message="Enter your Username" /><br>
Password:<cfinput type="password" name="password" required="true"
message="Enter your Password" /><br>
<cfinput type="submit" name="submit" value="Go Get In">
</cfform>
</cfoutput>


1st one is working fine with Messages, 2nd not.

I put #rc.message# in layout.default


Thanks,
-Jermy
> > -- Margaret Atwood- Hide quoted text -

Fernandez, Miguel

unread,
Oct 7, 2010, 2:39:09 PM10/7/10
to framew...@googlegroups.com
What they are saying is that the query string portion of your action is not formatted correctly. By default, FW1 syntax is "index.cfm?action=section.item". So the form action in your second example should look like:

<cfform name="login" id="login" action="index.cfm?action=login.authenticate"
method="post">

I think you are getting confused with the action attribute of the form tag. Does that help?

- Miguel

<cfoutput>

--

Sean Corfield

unread,
Oct 7, 2010, 9:07:42 PM10/7/10
to framew...@googlegroups.com
On Thu, Oct 7, 2010 at 11:24 AM, Jermy <jerm...@gmail.com> wrote:
> My question is... Does <cfset variables.fw.redirect('login.login',
> 'message')/>   works only when form action is
> #buildURL('login.authenticate')# ?

They have nothing to do with each other.

> It is not working when form action is action="index.cfm?
> login.authenticate".

That's not a valid URL, as I said in my last reply.


--
Sean A Corfield -- (904) 302-SEAN

Railo Technologies, Inc. -- http://getrailo.com/
An Architect's View -- http://corfield.org/

Jermy

unread,
Oct 8, 2010, 2:35:27 PM10/8/10
to framework-one
What I can think after reading above comments "index.cfm?
login.authenticate" is not a correct URL, its a query string. The
right way to set a URL is ="#buildURL('login.authenticate')#".

I know this is FW/1 group, if possible can some explain "index.cfm?
login.authenticate". Because both are working(only not with message in
this case) for me.

Thanks,
Jermy

On Oct 8, 6:07 am, Sean Corfield <seancorfi...@gmail.com> wrote:
> On Thu, Oct 7, 2010 at 11:24 AM, Jermy <jermy...@gmail.com> wrote:
> > My question is... Does <cfset variables.fw.redirect('login.login',
> > 'message')/>   works only when form action is
> > #buildURL('login.authenticate')# ?
>
> They have nothing to do with each other.
>
> > It is not working when form action is action="index.cfm?
> > login.authenticate".
>
> That's not a valid URL, as I said in my last reply.
> --
> Sean A Corfield -- (904) 302-SEAN
> Railo Technologies, Inc. --http://getrailo.com/
> An Architect's View --http://corfield.org/

enigment

unread,
Oct 8, 2010, 2:55:42 PM10/8/10
to framew...@googlegroups.com
Query strings are in the form fieldName=value. Yours doesn't have an =
sign, effectively meaning that there's a *field* named
'login.authenticate' with a blank value. It looks like maybe it's
supposed to be index.cfm?action=login.authenticate -- note the
'action=' in there.

Dave

Jermy

unread,
Oct 14, 2010, 10:19:42 AM10/14/10
to framework-one
Thank You all for your ans.

Thanks,
Jermy
Reply all
Reply to author
Forward
0 new messages