On Dec 17, 4:52 am, "Sergio Cambra .:: entreCables S.L. ::."
<[email protected]> wrote:
> On Jueves, 17 de Diciembre de 2009 10:59:46 Swartz escribió:

> Also, you can use after_render_field (maybe it's the best way). Define
> after_render_field in your controller to set @record.member_pay from 
> membership
> cost:
>
> def after_render_field(record, column)
>   record.member_pay = record.membership.cost
> end
Hmmmm... this function appears to not be called at all.
I defined this in the MembersController right after the AS block.
I even inserted a breakpoint in the function to see if it gets called.
It simply doesn't get called.

With just
config.columns[:membership].options = {:update_column => :member_pay}
It appears that the member_pay field gets updated whenever I select a
different membership option from drop down menu.
As indicated by this AJAX response:

try {
 $("record_member_pay_").up("li").update("\n<dl class=\"\">\n <dt>\n
<label for=\"record_member_pay_\">Member Pay</label>\n </dt>\n <dd>\n
<input autocomplete=\"off\" class=\"member-pay-input text-input\" id=
\"record_member_pay_\" name=\"record[member_pay]\" size=\"30\" type=
\"text\" />\n <span class=\"description\"></span>\n </dd>\n</dl>");
}
// ... snipped the catch block ...


The only thing needed is to add value="X" attribute for <input> tags
generated by AJAX responses for each membership option. Just can't
figure out how the heck to do it.

I have toyed with this idea:
config.columns[:membership].options = {:html_options => {:onchange =>
"$('record_member_pay_').value = 'XXXXXX';"}}

Where XXXXX would be the appropriate cost for whatever membership I
selected. But this only works with one value.



PS.

--

You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails plugin" 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/activescaffold?hl=en.


Reply via email to