Loading ...
Sorry, an error occurred while loading the content.

Re: Where should I handle errors in the URL?

Expand Messages
  • Brian
    After doing some work yesterday I realized the model wouldn t work. These are my model function arguments:
    Message 1 of 12 , Apr 21, 2009
    • 0 Attachment
      After doing some work yesterday I realized the model wouldn't work.
      These are my model function arguments:
      <cfargument name="ID" type="GUID">
      <cfargument name="Name" type="String">
      <cfargument name="Age" type="Numeric">

      It throws an error if you try to pass something other than a GUID to
      that function. You really have to validate in the controller. Im doing
      it like this (the isvalid function works well).

      Controller:
      <cfset individualID = event.getValue("id")>
      <cfif isValid("GUID",individualID)>
      ....do stuff
      <cfelse>
      ...handle error
      </cfif>


      Now that I have that figured out (thanks guys), do I populate an Error
      variable and pass that to a display page saying, "Invalid id" ?

      Something like:
      <cfset body = "Invalid id" />
      <cfset myFusebox.do( action="display.dsp_EditIndividual",
      contentvariable="body" ) />




      --- In fusebox5@yahoogroups.com, "Seth Johnson" <sjohnson@...> wrote:
      >
      > Whoops, I meant controller.
      >
      >
      >
      > <cfif event.getValue('id') EQ ''>
      >
      > <!--- handle missing Id logic--->
      >
      > <cfelseif len(event.getValue('id')) NEQ 36>
      >
      > <!--- handle invalid uudi logic--->
      >
      > </cfif>
      >
      >
      >
      > From: fusebox5@yahoogroups.com [mailto:fusebox5@yahoogroups.com] On
      Behalf
      > Of Seth Johnson
      > Sent: Tuesday, April 21, 2009 8:41 AM
      > To: fusebox5@yahoogroups.com
      > Subject: RE: [fusebox5] Where should I handle errors in the URL?
      >
      >
      >
      >
      >
      >
      >
      >
      > You can test for all of these cases in the model.
      >
      >
      > Seth
      >
      >
      >
      > From: fusebox5@yahoogroups.com [mailto:fusebox5@yahoogroups.com] On
      Behalf
      > Of Brian
      > Sent: Monday, April 20, 2009 12:14 PM
      > To: fusebox5@yahoogroups.com
      > Subject: [fusebox5] Where should I handle errors in the URL?
      >
      >
      >
      >
      >
      >
      >
      >
      >
      > This is a correct URL for my application.
      >
      http://domainname.com/learnfusebox/index.cfm/fa/app.listindividualusingc\
      fc/i
      > d/193686b8-4e3c-4752-ab2a-82aaf065153d
      >
      > Note - Im using SES urls and fusebox_parameters.fuseactionVariable =
      "fa".
      >
      > Where should I handle the following common errors? Model, view or
      > controller?
      >
      > 1) ID is not in the url:
      >
      http://domainname.com/learnfusebox/index.cfm/fa/app.listindividualusingc\
      fc/i
      > d/
      >
      > 2) ID is in the URL but its not a valid GUID:
      >
      http://domainname.com/learnfusebox/index.cfm/fa/app.listindividualusingc\
      fc/i
      > d/fwergr456hh
      >
      > 3) ID is not present:
      >
      http://domainname.com/learnfusebox/index.cfm/fa/app.listindividualusingc\
      fc
      >
    • Seth Johnson
      Then in the dsp page use #event.getValue( body )# or #attributes.body#. From: fusebox5@yahoogroups.com
      Message 2 of 12 , Apr 21, 2009
      • 0 Attachment

        <cfset event.setValue('body','Invalid id') />

         

        Then in the dsp page use #event.getValue('body')# or #attributes.body#.

         

         

        From: fusebox5@yahoogroups.com [mailto:fusebox5@yahoogroups.com] On Behalf Of Brian
        Sent: Tuesday, April 21, 2009 10:10 AM
        To: fusebox5@yahoogroups.com
        Subject: [fusebox5] Re: Where should I handle errors in the URL?

         




        After doing some work yesterday I realized the model wouldn't work.
        These are my model function arguments:
        <cfargument name="ID" type="GUID">
        <cfargument name="Name" type="String">
        <cfargument name="Age" type="Numeric">

        It throws an error if you try to pass something other than a GUID to
        that function. You really have to validate in the controller. Im doing
        it like this (the isvalid function works well).

        Controller:
        <cfset individualID = event.getValue("id")>
        <cfif isValid("GUID",individualID)>
        ....do stuff
        <cfelse>
        ...handle error
        </cfif>

        Now that I have that figured out (thanks guys), do I populate an Error
        variable and pass that to a display page saying, "Invalid id" ?

        Something like:
        <cfset body = "Invalid id" />
        <cfset myFusebox.do( action="display.dsp_EditIndividual",
        contentvariable="body" ) />

        --- In fusebox5@yahoogroups.com, "Seth Johnson" <sjohnson@...> wrote:

        >
        > Whoops, I meant controller.
        >
        >
        >
        > <cfif event.getValue('id') EQ ''>
        >
        > <!--- handle missing Id logic--->
        >
        > <cfelseif len(event.getValue('id')) NEQ 36>
        >
        > <!--- handle invalid uudi logic--->
        >
        > </cfif>
        >
        >
        >
        > From: fusebox5@yahoogroups.com
        [mailto:fusebox5@yahoogroups.com] On
        Behalf
        > Of Seth Johnson
        > Sent: Tuesday, April 21, 2009 8:41 AM
        > To: fusebox5@yahoogroups.com
        > Subject: RE: [fusebox5] Where should I handle errors in the URL?
        >
        >
        >
        >
        >
        >
        >
        >
        > You can test for all of these cases in the model.
        >
        >
        > Seth
        >
        >
        >
        > From: fusebox5@yahoogroups.com
        [mailto:fusebox5@yahoogroups.com] On
        Behalf
        > Of Brian
        > Sent: Monday, April 20, 2009 12:14 PM
        > To: fusebox5@yahoogroups.com
        > Subject: [fusebox5] Where should I handle errors in the URL?
        >
        >
        >
        >
        >
        >
        >
        >
        >
        > This is a correct URL for my application.
        >
        http://domainname.com/learnfusebox/index.cfm/fa/app.listindividualusingc\
        fc/i

        > d/193686b8-4e3c-4752-ab2a-82aaf065153d
        >
        > Note - Im using SES urls and fusebox_parameters.fuseactionVariable =
        "fa".
        >
        > Where should I handle the following common errors? Model, view or
        > controller?
        >
        > 1) ID is not in the url:
        >
        http://domainname.com/learnfusebox/index.cfm/fa/app.listindividualusingc\
        fc/i

        > d/
        >
        > 2) ID is in the URL but its not a valid GUID:
        >
        http://domainname.com/learnfusebox/index.cfm/fa/app.listindividualusingc\
        fc/i

        > d/fwergr456hh
        >
        > 3) ID is not present:
        >
        http://domainname.com/learnfusebox/index.cfm/fa/app.listindividualusingc\
        fc

        >

      • dickbob@gmail.com
        A bit off topic but I didn t know that you could reference a value set in the controller ,via event.setValue(), as being in the attributes scope of the display
        Message 3 of 12 , Apr 22, 2009
        • 0 Attachment
          A bit off topic but I didn't know that you could reference a value set in
          the controller ,via event.setValue(), as being in the attributes scope of
          the display fuse.

          Is that a designed or undocumented feature (bug)?

          dickbob


          > From: Seth Johnson <sjohnson@...>
          > Reply-To: <fusebox5@yahoogroups.com>
          > Date: Tue, 21 Apr 2009 13:46:03 -0400
          > To: <fusebox5@yahoogroups.com>
          > Subject: RE: [fusebox5] Re: Where should I handle errors in the URL?
          >
          > <cfset event.setValue('body','Invalid id') />
          >
          >
          >
          > Then in the dsp page use #event.getValue('body')# or #attributes.body#.
          >
          >
          >
          >
          >
          > From: fusebox5@yahoogroups.com [mailto:fusebox5@yahoogroups.com] On Behalf
          > Of Brian
          > Sent: Tuesday, April 21, 2009 10:10 AM
          > To: fusebox5@yahoogroups.com
          > Subject: [fusebox5] Re: Where should I handle errors in the URL?
          >
          >
          >
          >
          >
          >
          >
          >
          > After doing some work yesterday I realized the model wouldn't work.
          > These are my model function arguments:
          > <cfargument name="ID" type="GUID">
          > <cfargument name="Name" type="String">
          > <cfargument name="Age" type="Numeric">
          >
          > It throws an error if you try to pass something other than a GUID to
          > that function. You really have to validate in the controller. Im doing
          > it like this (the isvalid function works well).
          >
          > Controller:
          > <cfset individualID = event.getValue("id")>
          > <cfif isValid("GUID",individualID)>
          > ....do stuff
          > <cfelse>
          > ...handle error
          > </cfif>
          >
          > Now that I have that figured out (thanks guys), do I populate an Error
          > variable and pass that to a display page saying, "Invalid id" ?
          >
          > Something like:
          > <cfset body = "Invalid id" />
          > <cfset myFusebox.do( action="display.dsp_EditIndividual",
          > contentvariable="body" ) />
          >
          > --- In fusebox5@yahoogroups.com <mailto:fusebox5%40yahoogroups.com> , "Seth
          > Johnson" <sjohnson@...> wrote:
          >>
          >> Whoops, I meant controller.
          >>
          >>
          >>
          >> <cfif event.getValue('id') EQ ''>
          >>
          >> <!--- handle missing Id logic--->
          >>
          >> <cfelseif len(event.getValue('id')) NEQ 36>
          >>
          >> <!--- handle invalid uudi logic--->
          >>
          >> </cfif>
          >>
          >>
          >>
          >> From: fusebox5@yahoogroups.com <mailto:fusebox5%40yahoogroups.com>
          > [mailto:fusebox5@yahoogroups.com <mailto:fusebox5%40yahoogroups.com> ] On
          > Behalf
          >> Of Seth Johnson
          >> Sent: Tuesday, April 21, 2009 8:41 AM
          >> To: fusebox5@yahoogroups.com <mailto:fusebox5%40yahoogroups.com>
          >> Subject: RE: [fusebox5] Where should I handle errors in the URL?
          >>
          >>
          >>
          >>
          >>
          >>
          >>
          >>
          >> You can test for all of these cases in the model.
          >>
          >>
          >> Seth
          >>
          >>
          >>
          >> From: fusebox5@yahoogroups.com <mailto:fusebox5%40yahoogroups.com>
          > [mailto:fusebox5@yahoogroups.com <mailto:fusebox5%40yahoogroups.com> ] On
          > Behalf
          >> Of Brian
          >> Sent: Monday, April 20, 2009 12:14 PM
          >> To: fusebox5@yahoogroups.com <mailto:fusebox5%40yahoogroups.com>
          >> Subject: [fusebox5] Where should I handle errors in the URL?
          >>
          >>
          >>
          >>
          >>
          >>
          >>
          >>
          >>
          >> This is a correct URL for my application.
          >>
          > http://domainname.com/learnfusebox/index.cfm/fa/app.listindividualusingc\
          > <http://domainname.com/learnfusebox/index.cfm/fa/app.listindividualusingcfc/
          > i>
          > fc/i
          >> d/193686b8-4e3c-4752-ab2a-82aaf065153d
          >>
          >> Note - Im using SES urls and fusebox_parameters.fuseactionVariable =
          > "fa".
          >>
          >> Where should I handle the following common errors? Model, view or
          >> controller?
          >>
          >> 1) ID is not in the url:
          >>
          > http://domainname.com/learnfusebox/index.cfm/fa/app.listindividualusingc\
          > <http://domainname.com/learnfusebox/index.cfm/fa/app.listindividualusingcfc/
          > i>
          > fc/i
          >> d/
          >>
          >> 2) ID is in the URL but its not a valid GUID:
          >>
          > http://domainname.com/learnfusebox/index.cfm/fa/app.listindividualusingc\
          > <http://domainname.com/learnfusebox/index.cfm/fa/app.listindividualusingcfc/
          > i>
          > fc/i
          >> d/fwergr456hh
          >>
          >> 3) ID is not present:
          >>
          > http://domainname.com/learnfusebox/index.cfm/fa/app.listindividualusingc\
          > <http://domainname.com/learnfusebox/index.cfm/fa/app.listindividualusingcfc>
          >
          > fc
          >>
          >
          >
          >
        • MarkW
          I thought that the event scope was an encapsulation of the (global) attributes scope, so you can access the attributes scope anywhere within your fusebox app
          Message 4 of 12 , Apr 22, 2009
          • 0 Attachment
            I thought that the event scope was an encapsulation of the (global) attributes scope, so you can access the attributes scope anywhere within your fusebox app (outside of cffunctions). This also seems handy for backwards compatibility if people are moving from attributes.variablename approach to using the event approach, so you don't break attributes scope references.

            Seems designed unless I'm misunderstanding the relationship between Event and attributes scope.

            Mark

            On Wed, Apr 22, 2009 at 8:27 AM, <dickbob@...> wrote:

            A bit off topic but I didn't know that you could reference a value set in
            the controller ,via event.setValue(), as being in the attributes scope of
            the display fuse.

            Is that a designed or undocumented feature (bug)?

            dickbob

            > From: Seth Johnson <sjohnson@...>
            > Reply-To: <fusebox5@yahoogroups.com>
            > Date: Tue, 21 Apr 2009 13:46:03 -0400
            > To: <fusebox5@yahoogroups.com>
            > Subject: RE: [fusebox5] Re: Where should I handle errors in the URL?


            >
            > <cfset event.setValue('body','Invalid id') />
            >
            >
            >
            > Then in the dsp page use #event.getValue('body')# or #attributes.body#.
            >
            >
            >
            >
            >
            > From: fusebox5@yahoogroups.com [mailto:fusebox5@yahoogroups.com] On Behalf
            > Of Brian
            > Sent: Tuesday, April 21, 2009 10:10 AM
            > To: fusebox5@yahoogroups.com
            > Subject: [fusebox5] Re: Where should I handle errors in the URL?
            >
            >
            >
            >
            >
            >
            >
            >
            > After doing some work yesterday I realized the model wouldn't work.
            > These are my model function arguments:
            > <cfargument name="ID" type="GUID">
            > <cfargument name="Name" type="String">
            > <cfargument name="Age" type="Numeric">
            >
            > It throws an error if you try to pass something other than a GUID to
            > that function. You really have to validate in the controller. Im doing
            > it like this (the isvalid function works well).
            >
            > Controller:
            > <cfset individualID = event.getValue("id")>
            > <cfif isValid("GUID",individualID)>
            > ....do stuff
            > <cfelse>
            > ...handle error
            > </cfif>
            >
            > Now that I have that figured out (thanks guys), do I populate an Error
            > variable and pass that to a display page saying, "Invalid id" ?
            >
            > Something like:
            > <cfset body = "Invalid id" />
            > <cfset myFusebox.do( action="display.dsp_EditIndividual",
            > contentvariable="body" ) />
            >
            > --- In fusebox5@yahoogroups.com <mailto:fusebox5%40yahoogroups.com> , "Seth

            > Johnson" <sjohnson@...> wrote:
            >>
            >> Whoops, I meant controller.
            >>
            >>
            >>
            >> <cfif event.getValue('id') EQ ''>
            >>
            >> <!--- handle missing Id logic--->
            >>
            >> <cfelseif len(event.getValue('id')) NEQ 36>
            >>
            >> <!--- handle invalid uudi logic--->
            >>
            >> </cfif>
            >>
            >>
            >>
            >> From: fusebox5@yahoogroups.com <mailto:fusebox5%40yahoogroups.com>
            > [mailto:fusebox5@yahoogroups.com <mailto:fusebox5%40yahoogroups.com> ] On

            > Behalf
            >> Of Seth Johnson
            >> Sent: Tuesday, April 21, 2009 8:41 AM
            >> To: fusebox5@yahoogroups.com <mailto:fusebox5%40yahoogroups.com>

            >> Subject: RE: [fusebox5] Where should I handle errors in the URL?
            >>
            >>
            >>
            >>
            >>
            >>
            >>
            >>
            >> You can test for all of these cases in the model.
            >>
            >>
            >> Seth
            >>
            >>
            >>
            >> From: fusebox5@yahoogroups.com <mailto:fusebox5%40yahoogroups.com>
            > [mailto:fusebox5@yahoogroups.com <mailto:fusebox5%40yahoogroups.com> ] On

            > Behalf
            >> Of Brian
            >> Sent: Monday, April 20, 2009 12:14 PM
            >> To: fusebox5@yahoogroups.com <mailto:fusebox5%40yahoogroups.com>

            >> Subject: [fusebox5] Where should I handle errors in the URL?
            >>
            >>
            >>
            >>
            >>
            >>
            >>
            >>
            >>
            >> This is a correct URL for my application.
            >>
            > http://domainname.com/learnfusebox/index.cfm/fa/app.listindividualusingc\
            > <http://domainname.com/learnfusebox/index.cfm/fa/app.listindividualusingcfc/
            > i>
            > fc/i
            >> d/193686b8-4e3c-4752-ab2a-82aaf065153d
            >>
            >> Note - Im using SES urls and fusebox_parameters.fuseactionVariable =
            > "fa".
            >>
            >> Where should I handle the following common errors? Model, view or
            >> controller?
            >>
            >> 1) ID is not in the url:
            >>
            > http://domainname.com/learnfusebox/index.cfm/fa/app.listindividualusingc\
            > <http://domainname.com/learnfusebox/index.cfm/fa/app.listindividualusingcfc/
            > i>
            > fc/i
            >> d/
            >>
            >> 2) ID is in the URL but its not a valid GUID:
            >>
            > http://domainname.com/learnfusebox/index.cfm/fa/app.listindividualusingc\
            > <http://domainname.com/learnfusebox/index.cfm/fa/app.listindividualusingcfc/
            > i>
            > fc/i
            >> d/fwergr456hh
            >>
            >> 3) ID is not present:
            >>
            > http://domainname.com/learnfusebox/index.cfm/fa/app.listindividualusingc\
            > <http://domainname.com/learnfusebox/index.cfm/fa/app.listindividualusingcfc>
            >
            > fc
            >>
            >
            >
            >


          • Seth Johnson
            I think Sean mentioned that it was by design for legacy purposes, best practice would probably be to use the event syntax. From: fusebox5@yahoogroups.com
            Message 5 of 12 , Apr 22, 2009
            • 0 Attachment

              I think Sean mentioned that it was by design for legacy purposes, best practice would probably be to use the event syntax.  

               

              From: fusebox5@yahoogroups.com [mailto:fusebox5@yahoogroups.com] On Behalf Of MarkW
              Sent: Wednesday, April 22, 2009 2:43 PM
              To: fusebox5@yahoogroups.com
              Subject: Re: [fusebox5] Re: Where should I handle errors in the URL?

              I thought that the event scope was an encapsulation of the (global) attributes scope, so you can access the attributes scope anywhere within your fusebox app (outside of cffunctions). This also seems handy for backwards compatibility if people are moving from attributes.variablename approach to using the event approach, so you don't break attributes scope references.

              Seems designed unless I'm misunderstanding the relationship between Event and attributes scope.

              Mark

              On Wed, Apr 22, 2009 at 8:27 AM, <dickbob@...> wrote:

              A bit off topic but I didn't know that you could reference a value set in
              the controller ,via event.setValue(), as being in the attributes scope of
              the display fuse.

              Is that a designed or undocumented feature (bug)?

              dickbob

              > From: Seth Johnson <
              target="_blank">sjohnson@...>
              > Reply-To: <fusebox5@yahoogroups.com>
              > Date: Tue, 21 Apr 2009 13:46:03 -0400
              > To: <fusebox5@yahoogroups.com>
              > Subject: RE: [fusebox5] Re: Where should I handle errors in the URL?


              >
              > <cfset event.setValue('body','Invalid id') />
              >
              >
              >
              > Then in the dsp page use #event.getValue('body')# or #attributes.body#.
              >
              >
              >
              >
              >
              > From: fusebox5@yahoogroups.com
              [mailto:fusebox5@yahoogroups.com] On Behalf
              > Of Brian
              > Sent: Tuesday, April 21, 2009 10:10 AM
              > To: fusebox5@yahoogroups.com
              > Subject: [fusebox5] Re: Where should I handle errors in the URL?
              >
              >
              >
              >
              >
              >
              >
              >
              > After doing some work yesterday I realized the model wouldn't work.
              > These are my model function arguments:
              > <cfargument name="ID" type="GUID">
              > <cfargument name="Name" type="String">
              > <cfargument name="Age" type="Numeric">
              >
              > It throws an error if you try to pass something other than a GUID to
              > that function. You really have to validate in the controller. Im doing
              > it like this (the isvalid function works well).
              >
              > Controller:
              > <cfset individualID = event.getValue("id")>
              > <cfif isValid("GUID",individualID)>
              > ....do stuff
              > <cfelse>
              > ...handle error
              > </cfif>
              >
              > Now that I have that figured out (thanks guys), do I populate an Error
              > variable and pass that to a display page saying, "Invalid id" ?
              >
              > Something like:
              > <cfset body = "Invalid id" />
              > <cfset myFusebox.do( action="display.dsp_EditIndividual",
              > contentvariable="body" ) />
              >

              > --- In

              href="mailto:fusebox5%40yahoogroups.com" target="_blank">fusebox5@yahoogroups.com <mailto:fusebox5%40yahoogroups.com> , "Seth


              > Johnson" <sjohnson@...> wrote:
              >>
              >> Whoops, I meant controller.
              >>
              >>
              >>
              >> <cfif event.getValue('id') EQ ''>
              >>
              >> <!--- handle missing Id logic--->
              >>
              >> <cfelseif len(event.getValue('id')) NEQ 36>
              >>
              >> <!--- handle invalid uudi logic--->
              >>
              >> </cfif>
              >>
              >>
              >>

              >> From:

              href="mailto:fusebox5%40yahoogroups.com" target="_blank">fusebox5@yahoogroups.com <mailto:fusebox5%40yahoogroups.com>
              > [mailto:fusebox5@yahoogroups.com
              <mailto:fusebox5%40yahoogroups.com> ] On


              > Behalf
              >> Of Seth Johnson
              >> Sent: Tuesday, April 21, 2009 8:41 AM

              >> To:

              href="mailto:fusebox5%40yahoogroups.com" target="_blank">fusebox5@yahoogroups.com <mailto:fusebox5%40yahoogroups.com>


              >> Subject: RE: [fusebox5] Where should I handle errors in the URL?
              >>
              >>
              >>
              >>
              >>
              >>
              >>
              >>
              >> You can test for all of these cases in the model.
              >>
              >>
              >> Seth
              >>
              >>
              >>

              >> From:

              href="mailto:fusebox5%40yahoogroups.com" target="_blank">fusebox5@yahoogroups.com <mailto:fusebox5%40yahoogroups.com>
              > [mailto:fusebox5@yahoogroups.com
              <mailto:fusebox5%40yahoogroups.com> ] On


              > Behalf
              >> Of Brian
              >> Sent: Monday, April 20, 2009 12:14 PM

              >> To:

              href="mailto:fusebox5%40yahoogroups.com" target="_blank">fusebox5@yahoogroups.com <mailto:fusebox5%40yahoogroups.com>


              >> Subject: [fusebox5] Where should I handle errors in the URL?
              >>
              >>
              >>
              >>
              >>
              >>
              >>
              >>
              >>
              >> This is a correct URL for my application.
              >>
              >
              href="http://domainname.com/learnfusebox/index.cfm/fa/app.listindividualusingc" target="_blank">http://domainname.com/learnfusebox/index.cfm/fa/app.listindividualusingc\

              > <

              href="http://domainname.com/learnfusebox/index.cfm/fa/app.listindividualusingcfc/" target="_blank">http://domainname.com/learnfusebox/index.cfm/fa/app.listindividualusingcfc/
              > i>

              > fc/i
              >> d/193686b8-4e3c-4752-ab2a-82aaf065153d
              >>
              >> Note - Im using SES urls and fusebox_parameters.fuseactionVariable =
              > "fa".
              >>
              >> Where should I handle the following common errors? Model, view or
              >> controller?
              >>
              >> 1) ID is not in the url:
              >>
              >

              href="http://domainname.com/learnfusebox/index.cfm/fa/app.listindividualusingc" target="_blank">http://domainname.com/learnfusebox/index.cfm/fa/app.listindividualusingc\

              > <

              href="http://domainname.com/learnfusebox/index.cfm/fa/app.listindividualusingcfc/" target="_blank">http://domainname.com/learnfusebox/index.cfm/fa/app.listindividualusingcfc/
              > i>

              > fc/i
              >> d/
              >>
              >> 2) ID is in the URL but its not a valid GUID:
              >>
              >

              href="http://domainname.com/learnfusebox/index.cfm/fa/app.listindividualusingc" target="_blank">http://domainname.com/learnfusebox/index.cfm/fa/app.listindividualusingc\

              > <

              href="http://domainname.com/learnfusebox/index.cfm/fa/app.listindividualusingcfc/" target="_blank">http://domainname.com/learnfusebox/index.cfm/fa/app.listindividualusingcfc/
              > i>

              > fc/i
              >> d/fwergr456hh
              >>
              >> 3) ID is not present:
              >>
              >

              href="http://domainname.com/learnfusebox/index.cfm/fa/app.listindividualusingc" target="_blank">http://domainname.com/learnfusebox/index.cfm/fa/app.listindividualusingc\

              > <

              href="http://domainname.com/learnfusebox/index.cfm/fa/app.listindividualusingcfc" target="_blank">http://domainname.com/learnfusebox/index.cfm/fa/app.listindividualusingcfc>
              >
              > fc
              >>
              >
              >
              >

               

            • dickbob@gmail.com
              Okay, that got me re-reading Sean s Fusebox 5.1 Enhancements and Release Notes and his words are ...a new variable event exists alongside the attributes
              Message 6 of 12 , Apr 23, 2009
              • 0 Attachment
                Okay, that got me re-reading Sean's Fusebox 5.1 Enhancements and Release
                Notes and his words are "...a new variable 'event' exists alongside the
                'attributes' scope variable." and "...[event] is now an alternative to the
                'attributes' scope." when considering a object-oriented approach to no-XML
                Fusebox.

                I guess we should be encouraging the use of event rather than attributes?

                Worth re-reading those fine notes. I found event.valueExists() which I plan
                to test and could use.

                Nice reminder Seth!

                dickbob


                > From: Seth Johnson <sjohnson@...>
                > Reply-To: <fusebox5@yahoogroups.com>
                > Date: Wed, 22 Apr 2009 15:36:14 -0400
                > To: <fusebox5@yahoogroups.com>
                > Subject: RE: [fusebox5] Re: Where should I handle errors in the URL?
                >
                > I think Sean mentioned that it was by design for legacy purposes, best
                > practice would probably be to use the event syntax.
                >
                >
                >
                > From: fusebox5@yahoogroups.com [mailto:fusebox5@yahoogroups.com] On Behalf
                > Of MarkW
                > Sent: Wednesday, April 22, 2009 2:43 PM
                > To: fusebox5@yahoogroups.com
                > Subject: Re: [fusebox5] Re: Where should I handle errors in the URL?
                >
                > I thought that the event scope was an encapsulation of the (global)
                > attributes scope, so you can access the attributes scope anywhere within
                > your fusebox app (outside of cffunctions). This also seems handy for
                > backwards compatibility if people are moving from attributes.variablename
                > approach to using the event approach, so you don't break attributes scope
                > references.
                >
                > Seems designed unless I'm misunderstanding the relationship between Event
                > and attributes scope.
                >
                > Mark
                >
                > On Wed, Apr 22, 2009 at 8:27 AM, <dickbob@...> wrote:
                >
                > A bit off topic but I didn't know that you could reference a value set in
                > the controller ,via event.setValue(), as being in the attributes scope of
                > the display fuse.
                >
                > Is that a designed or undocumented feature (bug)?
                >
                > dickbob
                >
                >> From: Seth Johnson <sjohnson@...
                > <mailto:sjohnson%40todayrealestate.com> >
                >> Reply-To: <fusebox5@yahoogroups.com <mailto:fusebox5%40yahoogroups.com> >
                >> Date: Tue, 21 Apr 2009 13:46:03 -0400
                >> To: <fusebox5@yahoogroups.com <mailto:fusebox5%40yahoogroups.com> >
                >> Subject: RE: [fusebox5] Re: Where should I handle errors in the URL?
                >
                >
                >>
                >> <cfset event.setValue('body','Invalid id') />
                >>
                >>
                >>
                >> Then in the dsp page use #event.getValue('body')# or #attributes.body#.
                >>
                >>
                >>
                >>
                >>
                >> From: fusebox5@yahoogroups.com <mailto:fusebox5%40yahoogroups.com>
                > [mailto:fusebox5@yahoogroups.com <mailto:fusebox5%40yahoogroups.com> ] On
                > Behalf
                >> Of Brian
                >> Sent: Tuesday, April 21, 2009 10:10 AM
                >> To: fusebox5@yahoogroups.com <mailto:fusebox5%40yahoogroups.com>
                >> Subject: [fusebox5] Re: Where should I handle errors in the URL?
                >>
                >>
                >>
                >>
                >>
                >>
                >>
                >>
                >> After doing some work yesterday I realized the model wouldn't work.
                >> These are my model function arguments:
                >> <cfargument name="ID" type="GUID">
                >> <cfargument name="Name" type="String">
                >> <cfargument name="Age" type="Numeric">
                >>
                >> It throws an error if you try to pass something other than a GUID to
                >> that function. You really have to validate in the controller. Im doing
                >> it like this (the isvalid function works well).
                >>
                >> Controller:
                >> <cfset individualID = event.getValue("id")>
                >> <cfif isValid("GUID",individualID)>
                >> ....do stuff
                >> <cfelse>
                >> ...handle error
                >> </cfif>
                >>
                >> Now that I have that figured out (thanks guys), do I populate an Error
                >> variable and pass that to a display page saying, "Invalid id" ?
                >>
                >> Something like:
                >> <cfset body = "Invalid id" />
                >> <cfset myFusebox.do( action="display.dsp_EditIndividual",
                >> contentvariable="body" ) />
                >>
                >
                >> --- In fusebox5@yahoogroups.com <mailto:fusebox5%40yahoogroups.com>
                > <mailto:fusebox5%40yahoogroups.com <mailto:fusebox5%2540yahoogroups.com> > ,
                > "Seth
                >
                >
                >> Johnson" <sjohnson@...> wrote:
                >>>
                >>> Whoops, I meant controller.
                >>>
                >>>
                >>>
                >>> <cfif event.getValue('id') EQ ''>
                >>>
                >>> <!--- handle missing Id logic--->
                >>>
                >>> <cfelseif len(event.getValue('id')) NEQ 36>
                >>>
                >>> <!--- handle invalid uudi logic--->
                >>>
                >>> </cfif>
                >>>
                >>>
                >>>
                >
                >>> From: fusebox5@yahoogroups.com <mailto:fusebox5%40yahoogroups.com>
                > <mailto:fusebox5%40yahoogroups.com <mailto:fusebox5%2540yahoogroups.com> >
                >> [mailto:fusebox5@yahoogroups.com <mailto:fusebox5%40yahoogroups.com>
                > <mailto:fusebox5%40yahoogroups.com <mailto:fusebox5%2540yahoogroups.com> > ]
                > On
                >
                >
                >> Behalf
                >>> Of Seth Johnson
                >>> Sent: Tuesday, April 21, 2009 8:41 AM
                >
                >>> To: fusebox5@yahoogroups.com <mailto:fusebox5%40yahoogroups.com>
                > <mailto:fusebox5%40yahoogroups.com <mailto:fusebox5%2540yahoogroups.com> >
                >
                >
                >>> Subject: RE: [fusebox5] Where should I handle errors in the URL?
                >>>
                >>>
                >>>
                >>>
                >>>
                >>>
                >>>
                >>>
                >>> You can test for all of these cases in the model.
                >>>
                >>>
                >>> Seth
                >>>
                >>>
                >>>
                >
                >>> From: fusebox5@yahoogroups.com <mailto:fusebox5%40yahoogroups.com>
                > <mailto:fusebox5%40yahoogroups.com <mailto:fusebox5%2540yahoogroups.com> >
                >> [mailto:fusebox5@yahoogroups.com <mailto:fusebox5%40yahoogroups.com>
                > <mailto:fusebox5%40yahoogroups.com <mailto:fusebox5%2540yahoogroups.com> > ]
                > On
                >
                >
                >> Behalf
                >>> Of Brian
                >>> Sent: Monday, April 20, 2009 12:14 PM
                >
                >>> To: fusebox5@yahoogroups.com <mailto:fusebox5%40yahoogroups.com>
                > <mailto:fusebox5%40yahoogroups.com <mailto:fusebox5%2540yahoogroups.com> >
                >
                >
                >>> Subject: [fusebox5] Where should I handle errors in the URL?
                >>>
                >>>
                >>>
                >>>
                >>>
                >>>
                >>>
                >>>
                >>>
                >>> This is a correct URL for my application.
                >>>
                >> http://domainname.com/learnfusebox/index.cfm/fa/app.listindividualusingc\
                > <http://domainname.com/learnfusebox/index.cfm/fa/app.listindividualusingc>
                >
                >
                >>
                > <http://domainname.com/learnfusebox/index.cfm/fa/app.listindividualusingcfc/
                >> i>
                >
                >> fc/i
                >>> d/193686b8-4e3c-4752-ab2a-82aaf065153d
                >>>
                >>> Note - Im using SES urls and fusebox_parameters.fuseactionVariable =
                >> "fa".
                >>>
                >>> Where should I handle the following common errors? Model, view or
                >>> controller?
                >>>
                >>> 1) ID is not in the url:
                >>>
                >> http://domainname.com/learnfusebox/index.cfm/fa/app.listindividualusingc\
                > <http://domainname.com/learnfusebox/index.cfm/fa/app.listindividualusingc>
                >
                >
                >>
                > <http://domainname.com/learnfusebox/index.cfm/fa/app.listindividualusingcfc/
                >> i>
                >
                >> fc/i
                >>> d/
                >>>
                >>> 2) ID is in the URL but its not a valid GUID:
                >>>
                >> http://domainname.com/learnfusebox/index.cfm/fa/app.listindividualusingc\
                > <http://domainname.com/learnfusebox/index.cfm/fa/app.listindividualusingc>
                >
                >
                >>
                > <http://domainname.com/learnfusebox/index.cfm/fa/app.listindividualusingcfc/
                >> i>
                >
                >> fc/i
                >>> d/fwergr456hh
                >>>
                >>> 3) ID is not present:
                >>>
                >> http://domainname.com/learnfusebox/index.cfm/fa/app.listindividualusingc\
                > <http://domainname.com/learnfusebox/index.cfm/fa/app.listindividualusingc>
                >
                >
                >>
                > <http://domainname.com/learnfusebox/index.cfm/fa/app.listindividualusingcfc>
                >>
                >> fc
                >>>
                >>
                >>
                >>
                >
                >
                >
                >
                >
              • Sean Corfield
                ... Designed feature. It s how the attributes scope is made available inside a controller CFC in Fusebox 5.5 and it is exposed ( event ) in fuses, and
                Message 7 of 12 , Apr 26, 2009
                • 0 Attachment
                  On Wed, Apr 22, 2009 at 5:27 AM, <dickbob@...> wrote:
                  > A bit off topic but I didn't know that you could reference a value set in
                  > the controller ,via event.setValue(), as being in the attributes scope of
                  > the display fuse.
                  >
                  > Is that a designed or undocumented feature (bug)?

                  Designed feature. It's how the attributes 'scope' is made available
                  inside a controller CFC in Fusebox 5.5 and it is exposed ('event') in
                  fuses, and Application.cfc, for consistency. It's probably worth
                  noting that:

                  event.getAllValues() === attributes

                  i.e., the same actually struct.

                  event.getValue('foo') === attributes.foo

                  event.setValue('foo',someval) === attributes.foo = someval;

                  event.valueExists('foo') === structKeyExists(attributes,'foo')

                  event.removeValue('foo') === structDelete(attributes,'foo');

                  Other equivalences exposed via the event object are to do with XFAs:

                  event.xfa('bar') === xfa.bar

                  event.xfa('bar',action) === xfa.bar = action;

                  The second form also allows additional pairs of name/value URL pairs
                  to be added to an XFA (to mimic a common practice with XFAs and to
                  support myFusebox.relocate(xfa="xfaName");

                  event.xfa('bar',action,'x',1,'y',2) - xfa.bar is like fuseaction=action&x=1&y=2
                  --
                  Sean A Corfield -- (904) 302-SEAN
                  CTO, Railo US -- http://getrailo.com/
                  An Architect's View -- http://corfield.org/

                  "If you're not annoying somebody, you're not really alive."
                  -- Margaret Atwood
                Your message has been successfully submitted and would be delivered to recipients shortly.