El Monday 16 March 2009 14:53:06 Kenny Ortmann escribió:
> AS builds the id with this method
> def active_scaffold_input_options(column, scope = nil)
>   name = scope ? "record#{scope}[#{column.name}]" :
> "record[#{column.name}]" # Fix for keeping unique IDs in subform
>   id_control = "record_#{column.name}_#{[params[:eid],
> params[:id]].compact.join '_'}"
>   id_control += scope.gsub(/(\[|\])/, '_').gsub('__', '_').gsub(/_$/, '')
> if scope
>   { :name => name, :class => "#{column.name}-input", :id => id_control}
> end
>
> It appears that you don't have a scope option so you could just use the
> line below to figure out the name:
> id_control = "record_#{column.name}_#{[params[:eid],
> params[:id]].compact.join '_'}"
>

IMHO it's better to use
active_scaffold_input_options(active_scaffold_config.columns[:column_name])[:id]
so you don't need to change your helper if active_scaffold ids are changed.

Anyway I think it would be good to have options instead of only the field name
in the helpers, but it wouldn't be backwards compatible

> BUT if all you are trying to do is add rows to the column, you can use
>
> config.columns[:description].options = {:rows => 8} and this saves you the
> trouble of overriding the column.
>
> On Sun, Mar 15, 2009 at 11:02 AM, hoenth <[email protected]> wrote:
> > I have an Active-scaffold subform in which I would like to change the
> > size of a text field when the create/update form is displayed.
> >
> > I added the following to the parent controller helper file.
> >
> >  def description_form_column(record, input_name)
> >    text_area :record, :description, {:name => input_name, :rows => 8}
> >  end
> >
> > This works in the sense that the field now appears with only 8 rows.
> > However, the label for the field has the following options:
> >
> >  for="record_description_06b1599d48017869d098890717b14a05">
> >
> > while the field has the following options:
> >
> > id="record_description" rows="8" name="record[description]" cols="40"
> >
> > It appears that the EID is not being appended when I override the
> > field. is there something more that I should be doing to get the EID
> > appended. Since the for value is different from the fields ID value,
> > my tests that ask to "fill in 'Description' with 'This is a
> > description'" fail.
> >
> > Any help would be greatly appreciated.
> >
> > Tom
>
> 


-- 
Sergio Cambra .:: entreCables S.L. ::.
Nicolás Guillén 6, locales 2 y 3. 50.018 Zaragoza
T) 902 021 404 F) 976 52 98 07 E) [email protected]

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

  • Ca... hoenth
    • ... Kenny Ortmann
      • ... hoenth
      • ... Sergio Cambra .:: entreCables - Symbol Servicios Informáticos S.L. ::.

Reply via email to