setFormClass in ATK4.2

78 views
Skip to first unread message

Omone

unread,
May 25, 2012, 10:39:46 AM5/25/12
to Agile Toolkit Development
Hi All,

I'm trying to build a simple Form in a vertical layout but I'm unable
to change it from the default behavior.

This is the code I wrote down:

$f = $this->add('Form');
$f->setFormClass('vertical');
$f->addField('line','application_id');
$f->addField('line','position_number');
$f->addSubmit('Add');

Am I doing something wrong?

Thanks in advance,

Alessandro

Romans Malinovskis

unread,
May 25, 2012, 1:07:08 PM5/25/12
to agile-too...@googlegroups.com
Try using class = “stacked” and then adding class “span4” to each field, which should set their width. You might also need to set “atk-row” to a fieldset, try this code:

$f->setClass(’stacked’); // same as setFormClass
$f->template->trySet(‘fieldset’,’atk-row’);
$f->addField(‘line’,’application_id’)->addClass(’span3’); // determines width
$f->addField(‘line’,’position_number’)->addClass(’span4’); // wider
$f->addSeparator(‘atk-row’); // starts next row
$f->addField(’text’,’descr’)->addClass(’span12’); // full width


Perhaps we need to introduce some wrapper for setting the initial fieldset value.

Regards,
Romans
> --
> FYI: If amount of emails you receive from this group is too much - switch to "Digest" mode. You'll receive no more than 1 email per day.
>
> To post to this group, send email to
> agile-too...@googlegroups.com
>
> To unsubscribe and view archive:
> http://groups.google.com/group/agile-toolkit-devel?hl=en
>
> To download Agile Toolkit, visit:
> http://agiletoolkit.org/

Omone

unread,
May 28, 2012, 6:03:07 AM5/28/12
to Agile Toolkit Development
Thank you for suggestion, it worked fine.

On May 25, 7:07 pm, Romans Malinovskis <rom...@agiletoolkit.org>
wrote:

Marco Biondi

unread,
May 28, 2012, 11:42:51 AM5/28/12
to agile-too...@googlegroups.com
This mean that default form layouts (like horizontal, multiple column etc... as in samples) are unsupported in atk4.2?
> agile-toolkit-devel@googlegroups.com

Romans Malinovskis

unread,
May 28, 2012, 12:01:52 PM5/28/12
to agile-too...@googlegroups.com
That’s right, atk4.2 have a different CSS layout which can be applied to anything including form fields and it allows a much more flexible field configuration.

Backward compatible functionality can be done through a jQuery function.  Something like this:

$(‘form.form-2col’).find(‘atk-field’).each(function(){
  …...
});

r

Marco Biondi

unread,
May 28, 2012, 12:06:58 PM5/28/12
to agile-too...@googlegroups.com
Great thing!

So we need only new samples! :)

(I'll take a look into the form class to discover wich parameters must be passet/set to obtain an horizontal form...)

Janis

unread,
May 28, 2012, 12:34:06 PM5/28/12
to agile-too...@googlegroups.com
I think horizontal is default now. Vertical is stacked.
Reply all
Reply to author
Forward
0 new messages