I have followed along with the recipe "http://cookbook.hobocentral.net/
recipes/33-ajax-filtering-on-a-partially-complete" and I'm having some
trouble making it work. I've seen a lot of help for this but it's all
based on hobo 1.0. Edit works fine but the new form will not grab the
data and populate, the alevel drop down is unaffected. Anyone have any
helpful pointers on getting this to work properly?
Here's my models, controller and js:
#tcl.rb - This can be thought of as the "Order"
class Tcl < ActiveRecord::Base
hobo_model # Don't put anything above this
fields do
name :string
timestamps
end
belongs_to :tcap
belongs_to :alevel
...
#tcap.rb - This is the "Country"
class Tcap < ActiveRecord::Base
hobo_model # Don't put anything above this
fields do
name :string
timestamps
end
...
#alevel.rb - This is the "Shipping Method"
class Alevel < ActiveRecord::Base
hobo_model # Don't put anything above this
fields do
name :string
tcap_id :integer
timestamps
end
...
#application.js
Event.addBehavior({
"select.tcl_tcap:change": function(ev) {
Hobo.ajaxRequest(window.location.href, ["level-part"], {
params: Form.serialize(this.up("form")),
method: "get",
message: "Processing..."
});
}
});
and the view:
...
<def tag="form" for="Tcl">
<form with="&@tcl" method="put">
<error-messages param/>
<!--<after-submit uri="#{url_for(this_parent)}" />-->
<do part="level-part">
<field-list fields="tcap, alevel" >
<alevel-view:>
<if test="&@tcl.tcap">
<select-many include-none="&false"
options="&(this_parent.tcap.nil? ? [] :
Alevel.find_all_by_tcap_id(this_parent.tcap.id))"/>
</if>
<else>
<select disabled><option>First choose a Target
Capability</option></select>
</else>
</alevel-view:>
</field-list>
</do>
<div param="actions">
<submit label="#{ht 'tcl.actions.save', :default=>['Save']}"
param/>
</div>
</form>
</def>
...
--
You received this message because you are subscribed to the Google Groups "Hobo
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/hobousers?hl=en.