users.user.do_login

when I click submit on my login form, ColdBox takes me to the
following path

.com//index.cfm/users/user/dp_myaccount

even though in my login form the hidden value of e is #rc.xe_dologin#

I am new to COLDBOX and just lost.

MAIN.CFC
Event.setValue("xe_dologin","#local.e_dologin#");

local.e_dologin ="users.user.do_login";

USER.CFC
<cffunction name="do_login" access="public" returntype="void"
output="false">
    <cfargument name="Event" type="Any">
      <cfscript>
       var rc = Event.getCollection();
       var local = structNew();
           local.locstc = structNew();
           rc.msgErr_login="";

      if (getPlugin("cookiestorage").exists("UM") and getPlugin
("cookiestorage").exists("UP")){
           local.em=getPlugin("cookiestorage").getVar("UM");
             local.psw=getPlugin("cookiestorage").getVar("UP");
             rc.msgErr_login=do_loginall(ustrct=local);
       }
       else if( not Event.valueExists("userem") or not Event.valueExists
("userpsw") ){
             rc.msgErr_login="<p class='errMsg'>*Error on login!</

";

       }
       else if( rc.userem eq "" or rc.userpsw eq "" ){
             rc.msgErr_login="<p class='errMsg'>*Email and password are
required.</p>";

       }else{
           local.em=trim(rc.userem);
             local.psw=trim(rc.userpsw);
             rc.msgErr_login=do_loginall(ustrct=local);
             if(rc.msgErr_login eq ""){
          if(StructKeyExists(rc,"rememberMe")){
                getPlugin("cookiestorage").setVar("um",localpram.em,2);
                getPlugin("cookiestorage").setVar("up",localpram.psw,2);
            }
           }//END if(rc.msgErr_login neq ""
       }//END IF(getPlugin("cookiestorage").)

       if(rc.msgErr_login eq ""){

          local.mylastEvent=getPlugin("sessionstorage").getVar
("mylastEvent");
          local.myCurrentEvent=getPlugin("sessionstorage").getVar
("myCurrentEvent");

          if( local.mylastevent eq "general.dp_home" or local.mylastevent
eq "users.user.dp_login" or local.mylastevent eq
"users.user.do_login" ){
             setNextEvent("users.user.dp_myaccount");
          }
          else if( local.mylastevent neq "" and left(listLast(trim
(getPlugin("sessionstorage").getVar("myCurrentEvent")),"."),2) neq
"do"){

              setNextEvent("#local.mylastEvent#");
          }
            else{
              setNextEvent("users.user.dp_myaccount");
            }
       }
       else {
          ///Featured Jobs
          local.obj_jobg = getColdboxOCM().get('obj_job_g');
             localpram.isFeatured=1;
             localpram.limit1=0;
             localpram.limit2=5;
             localpram.id_jbstts=2;
             rc.qryTargetJobs = local.obj_jobg.readJobs
(Filter=localpram);
             ///
        rc.targetJobsHeaderDiv='<div style="margin-top:8px; margin-bottom:
5px; color:##003300; font-size:larger">FEATURED <font
color="##EC7600"><strong>JOBS</strong></font></div>';
             if(rc.qryTargetJobs.recordCount gt 0)
          Event.setValue('mainContentCol', getPlugin('renderer').renderView
('bdy/lft/jobs/vw_mainContentCs_fjobs'));
         //<!--- EXIT HANDLERS: --->
          Event.setValue("msgMCTop",getsetting("defaultMSGmcTop"));//

          Event.setValue("mctHeading","heading");
          Event.setValue("mctImg","mainImg");
          Event.setValue("navmenucrnthm",'style="background-
color:##9acd32;padding: 4.5px 10px 6px 10px;"');
          Event.setValue("fls","him_best");

          Event.setView('bdy/lft/vw_mainContentCs');
          Event.setValue('rgtContentTop', getPlugin('renderer').renderView
('bdy/rgt/vw_login'));
          Event.setValue('mainContentTop', getPlugin
('renderer').renderView('bdy/lft/vw_mainContentTop'));
          Event.setValue('containerCol', getPlugin('renderer').renderView
('bdy/rgt/vw_contColFls'));
       }
    </cfscript>
  </cffunction>

Ok, I'll try...

First:

Event.setValue("xe_dologin","#local.e_dologin#");
local.e_dologin ="users.user.do_login";

That won't work...

You need to switch them:

local.e_dologin ="users.user.do_login";
Event.setValue("xe_dologin","#local.e_dologin#");

You have to set local.e_dologin before you can use it :slight_smile:

Second:

I would move all of that div stuff, etc out of the handler. That stuff
should be set either in the view, layout or in a plugin. For example:

rc.targetJobsHeaderDiv = getPlugin("yourContentPlugin").getHeaderDiv
();

Then in your view / layout:

#rc.targetJobsHeaderDiv#

All of those error messages and HTML, etc... none of that should be in
the handler. You set values to the RC from the handler, then display
those values in the view. Use plugins or business objects to get the
values.

Your code is a little cluttered, so debugging your specific situation
isn't something I can do at the moment. I'll look when I have more
time, but in the meantime I'd suggest moving things out into separate
objects so you don't have a hard-to-read handler.