Steve,<br><br>It appears to me that you&#39;re trying to &quot;out-think&quot; Jifty or trying to get into the details of guts where Jifty provides high level tools so you shouldn&#39;t have to. <br><br><div><span class="gmail_quote">
On 10/14/07, <b class="gmail_sendername">Steve H</b> &lt;<a href="mailto:s_t_e_v_e_h@hotmail.com">s_t_e_v_e_h@hotmail.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>Hi<br><br>I&#39;m still having difficulty with Jifty design. Seems as though I should be using the Dispatcher to architect and manage the flow between the various windows/fragments. </blockquote><div><br>You are correct, the Dispatcher is the place to stick any code that glues things together. You use the Dispatcher to help make flow decisions, setup information to pass on to your views, and it ends up (at least in my apps) being the repository of everything that doesn&#39;t really belong anywhere else.
<br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Please correct me if I&#39;m making wrong assumptions and/or help with some detail.&nbsp;&nbsp;There are bits of it that don&#39;t appear to function as I&#39;d have anticipated.
<br>I figured on having Dispatcher code that would leverage &#39;before&#39;, &#39;on&#39;, etc code blocks, within which I&#39;d peek at the &#39;request&#39; and any submit vars for context and then &#39;show&#39; the various fragments that were relevant... 
</blockquote><div><br>It looks like you&#39;re trying to submit a form, but haven&#39;t created an Action to handle the form. You probably want to look into Jifty::Action and Jifty::Manual::Actions. Also, for every Model, Jifty automatically builds a nice search action for you, which may obviate the need to create your own (see Jifty::Action::Record and Jifty::Action::Record::Search).
<br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">for example a Search form from one fragment, when submitted, might rewrite the search entry field/fragment and then display the searched/found summary data into a different fragment that uses a Collection/pager;&nbsp;&nbsp;clicking a link on one of those summary lines in that fragment could a different fragment to update showing details.
<br>So I follow what seems to be implied by the docs and examples...&nbsp;&nbsp;firstly outputting debug from the Dispatcher to verify I&#39;d trapped the correct Jifty-&gt;web-&gt;request-&gt;path&nbsp;&nbsp;... then I wanted to ensure the correct context, so I tried a get(&#39;Srch&#39;) .. which Data::Dumper indicated was undef.&nbsp;&nbsp;...so I had a look at the 
<a href="http://Dispatcher.pm">Dispatcher.pm</a> module, and it indicated the get() was a call to Jifty-&gt;web-&gt;request-&gt;argument ... so I called that, and similarly got undef.&nbsp;&nbsp;I do however see the Srch arg buried in the data dumped from Jifty-&gt;web-&gt;request-&gt;arguments
<br>&gt;From debug statements in the Dispatcher, per:<br>before &#39;*&#39; =&gt; run {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print STDERR &quot;DBG: ...<br>}<br><br>DBG: REQUEST: before *&nbsp;&nbsp;get Srch: $VAR1 = \undef;<br>DBG: REQUEST: before *&nbsp;&nbsp;request-&gt;argument(Srch): $VAR1 = \undef;
<br>DBG: REQUEST: before *&nbsp;&nbsp;request-&gt;arguments: $VAR1 = [<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#39;J:A-auto-3c0293afb5c946d01eb6ca2b4df038f3-1&#39; =&gt; &#39;COS::Action::vsr_main&#39;,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#39;&#39; =&gt; &#39;Search&#39;,
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#39;region&#39; =&gt; bless( {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb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&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;];<br><br>This is all pretty confusing.&nbsp;&nbsp;The more I look at it, the more cross-eyed I get, and possibly digging myself deeper into the wrong hole.&nbsp;&nbsp;What seems to be the way to do things per the doco, doesn&#39;t give me the expected/desired results, making me wonder whether I&#39;m encountering:&nbsp;&nbsp; a) the wrong approach in the first place,&nbsp;&nbsp;b) misinterpreted behaviour/expectation,&nbsp;&nbsp;c) broken code,&nbsp;&nbsp;d) on it goes.
</blockquote><div><br>Just to help with some of the confusion, Jifty expects a form to be submitted in conjunction with an Action. This is typically done by running something like this. (I&#39;m assuming a model named &quot;Frobnicators&quot; exists with a column named &quot;name&quot; and am using the auto-generated search action for it.)
<br><br>In the dispatcher:<br><br>on &#39;/search&#39; =&gt; run {<br>my $action = Jifty-&gt;web-&gt;new_action( class =&gt; &#39;SearchFrobnicators&#39;, moniker =&gt; &#39;search-frobs&#39; );<br>set action =&gt; $action;
<br>}<br><br>In the &quot;share/web/templates/search&quot; Mason file (I&#39;m assuming you&#39;re still using Mason templates):<br><br>%# Render the form...<br>&lt;% Jifty-&gt;web-&gt;form-&gt;start %&gt;<br>&lt;% $action-&gt;form_field(&#39;name_contains&#39;) %&gt;
<br>&lt;% Jifty-&gt;web-&gt;submit( label =&gt; &#39;Search&#39; ) %&gt;<br>&lt;% Jifty-&gt;web-&gt;form-&gt;end %&gt;<br><br>%# Show the results...<br>% if (Jifty-&gt;response-&gt;result(&#39;search-frobs&#39;)-&gt;content(&#39;search&#39;)) {
<br>% my $result = Jifty-&gt;response-&gt;result(&#39;search-frobs&#39;)-&gt;content(&#39;search&#39;);<br>% while (my $frob = $result-&gt;next) {<br>&lt;p&gt;&lt;% $frob-&gt;name %&gt;&lt;/p&gt;<br>% }<br>% }<br></div>&lt;%var&gt;
<br>$action<br>&lt;/%var&gt;<br><br>With some modifications, this form could update a fragment instead of rendering the results after completely submitted and reloading the page, but I just wanted to get across the link between form processing and actions.
<br><br>I hope that helps to answer your question.<br><br>Cheers,<br>Sterling<br><br></div><br>