Problems, need help? Have a tip or advice? Post it here.
9 posts Page 1 of 1
Hello again!

I ran into an issue where I just can't figure out whats wrong with it, so it's kinda hard to give it a proper title. Maybe too many (although not really) redirects and IFs, but I'm just not sure.

Problem is, after the custom route takes effect (all is working there) I end up with an empty page, only when I refresh the page everything is as it should be.
The thing is part of a survey. In the add_view I ask for the initial information to create a page, and then redirect to the edit_view via the last entered ID. From there on I use an internal count (editable region) to indicate on which step on is within the survey, and display different forms accordingly. The latter all works fine, just not between the redirect of the add_view to the first load of the edit_view.

These are my defined routes and how those are then matched:
Code: Select all
<cms:route 
   name='add_view'
   path='add{:slash}'
   filters=''
   >

   <cms:route_constraints
      slash='(\/?)'
   />

</cms:route>

<cms:route
   name='edit_view'
   path='edit/{:ticket_id}/{:id}'
   filters='page_exists=id'
   >
   
   <cms:route_constraints
      slash='(\/?)'
   />
   <cms:route_validators
      ticket_id='title_ready | exact_len=15'
      id='non_zero_integer'
   />
</cms:route>

Code: Select all
<cms:else_if k_matched_route='add_view'/>
   <cms:if has_ticket>
      <cms:embed "survey_step0.html" />
   <cms:else/>
      log in with ticket or create account
   </cms:if>

<cms:else_if k_matched_route='edit_view'/>
   <cms:pages id=rt_id>
      <cms:related_pages 'ccdb_supplier' ><cms:set ticket_supplier=supdb_ticket 'global'/></cms:related_pages>
      <cms:if rt_ticket_id=ticket_supplier>
            <cms:embed "survey_step<cms:show ccdb_survey_step/>.html" />
      <cms:else/>
      No way, Hosay!
      </cms:if>
   </cms:pages>

And this is in short what the form/submit looks like in the add_view where I redirect afterwards to the edit_view to continue with the survey:
Code: Select all
<cms:form
   masterpage='template-name.php'
   mode='create'
   enctype='multipart/form-data'
   method='post'
   anchor='0'
   >

   <cms:if k_success >
      
      [...]

      <cms:db_persist_form
         _invalidate_cache='0'
         _auto_title='1'
         
         [...]
         
         ccdb_survey_step='2'
         [...]
      />
      
      <cms:if "<cms:not k_persist_error />">
         <cms:redirect url="<cms:route_link 'edit_view' masterpage='template-name.php' rt_ticket_id=supplier_ticket rt_id=k_last_insert_id />" />
      </cms:if>
      
   </cms:if>

   <cms:if k_error >
      <div class="error">
      <cms:each k_error >
      <br><cms:show item />
      </cms:each>
      </div>
   </cms:if>


   [- here are inputs -]

</cms:form>

What am I missing/doing wrong here? Some help would be highly appreciated!

I hope the information is sufficient. I'm of course happy to give all the information again and could provide the link to the live version if that is needed.
Post filter code (page_exists).
Hi Trendoman,

thank you very much for the swift reply! However removing the filter - I guess that is what you meant? - doesn't do anything to solve it, the page remains blank until I reload :/.
Nope, don't remove the filter since it is used in routing. Post its code in the topic for review, because you posted everything but that.
One shouldn't do two entirely different jobs at a time, sorry! ;)

I guess it's still more or less the standard code as in the tutorial:
Code: Select all
<cms:if arg_1='name'>
    <cms:if "<cms:not "<cms:page_exists name=rt_page_name masterpage=k_template_name />" />" >
        <cms:abort is_404='1' />
    </cms:if>
<cms:else_if arg_1='cm_page'/>
    <cms:if "<cms:not "<cms:page_exists name=rt_cm_name masterpage='corpmembers.php' />" />" >
        <cms:abort is_404='1' />
    </cms:if>
<cms:else_if arg_1='cm_user' />
    <cms:if "<cms:not "<cms:page_exists name="<cms:show rt_cm_name/>_<cms:show rt_user_name/>" masterpage=k_template_name />" />" >
        <cms:abort is_404='1' />
    </cms:if>
<cms:else />
    <cms:if "<cms:not "<cms:page_exists id=rt_id masterpage=k_template_name />" />" >
        <cms:abort is_404='1' />
    </cms:if>
</cms:if>
No ideas? :/
klaus wrote: No ideas? :/

Maybe this part missed show_future_entries parameter?
Code: Select all
<cms:pages id=rt_id>
YES! That did it! A week of sorrow and utter despair - thank you very much!!!
klaus wrote: YES! That did it! A week of sorrow and utter despair - thank you very much!!!

Sure, why not.. Happy Couching!
9 posts Page 1 of 1
cron