Hi Ed,

First of all, nice work. You are implementing a hard thing to do, moving
between pages and restoring data for forms. Another approach which might
work would be using modals, as you can have them in the DOM outside the
form.

I agree with Kevin that debugging the contents of this_parent and
this_parent.country_make should help. You will probably find that
"country_make" is nil. I suggest you look at the Ajax request that
happens in the first select:

- Is the parameter sent to the correct place?
- Does the controller do its job correctly? (receive the parameters,
instantiate a new object with them)
- How does the JS response look like?

Warm regards,
Ignacio


El 29/10/14 a las #4, Ed Gomolka escribió:
> 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]
> <mailto:[email protected]>.
> To post to this group, send email to [email protected]
> <mailto:[email protected]>.
> Visit this group at http://groups.google.com/group/hobousers.
> For more options, visit https://groups.google.com/d/optout.

-- 
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