Not sure on what you mean by setting the context as from your code it looks 
like you've got a good handle on implicit context already.  I'd probably 
start by sticking in a bit of temporary code to see what this_parent (and 
maybe .country_make) is actually giving at the point of the test.

On Wednesday, October 29, 2014 8:39:17 AM UTC-6, Ed Gomolka wrote:
>
> Hi!
>
> I have a problem that I need to solve when using the dynamic ajax select 
> feature of Hobo (
> http://hobocentral.net/tutorials/dynamic_ajax_select_menus).
> I am relatively new to Ruby, Rails, and Hobo.
>
> The primary issue is that I don't understand how the select-one tag 
> changes the context.
>
> Here is what I am doing:
> Under certain circumstances, I need to add a new value part way through my 
> dynamic select process. 
> I investigated the select-one-or-new dialog, but the formlet didn't have 
> all the features that I wanted, so I decided to take a different approach 
> that uses a full form.
>
> I added a link to my initial dynamic select page that takes me to a 
> simplified add page for the data item that I want to add.
> I now have two pages:
> - one page where I am doing the dynamic ajax select
> - a second page where I add a new data item that will then be available on 
> the first page as a selection.
>
> When I hit the save button on the second page, I am redirected back to the 
> first page.
> Here is where I run into a problem. I want to return to the first page and 
> have all of my original selections re-applied, so that the user doesn't 
> have to re-select anything that they have already selected.
> I have the selections saved in the session, and I should be able to 
> re-apply them.
> I played with select-one, but it doesn't have a "selected" option. I can 
> apply the selections to filter the select-one data so that the user only 
> sees their original selection; however, in this case, the user still needs 
> to re-select.
> I really want to still have all the original data available for selection, 
> but have the original selection pre-selected.
> I subsequently played with the select-input and select-menu tags.
> I can use the selected option of the select-input or select-menu tags to 
> select exactly what I want, but that doesn't set the context correctly for 
> the next selection box.
> Here is a small simplified DRYML code excerpt. The actual code is more 
> complex and has some logic that attempts to determine whether or not the 
> session parameters from a previous selection are available or not. It also 
> has about 5 layers of selections:
>
>     <country_make-view:>
>       <hot-input ajax>
>         <select-input options="&CountryMake.user_view(current_user.id, 
> current_user.country_id)" selected 
> ="&session[:trim_parms][:country_make_id]"/>
>       </hot-input>
>     </country_make-view:>
>     <country_model-view:>
>       <if test="&this_parent.country_make">
>         <hot-input ajax>
>           <select-menu options="&this_parent.country_make.country_model" 
> sort="true"/>
>         </hot-input>
>       </if>
>       <else>
>         <select disabled><option>First select a make</option></select>
>      </else>  
>     </country_model-view:>     
>         ........
>
> The above code never satisfies the "if test" logic, so I can't get to my 
> second selection box. I believe that I should be able to manually set the 
> context to resolve this problem. I read through the DRYML guide, but I 
> can't say that I have a clear idea of how to do that.
> Can someone shed a little light on this?
>
> Thx,
>
> Ed Gomolka
>
>

-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/hobousers.
For more options, visit https://groups.google.com/d/optout.

Reply via email to