Welcome, Guest
Username: Password: Remember me

TOPIC: JDom and custom attributes

JDom and custom attributes 12 Sep 2013 06:59 #11069

  • blue-canoe
  • blue-canoe's Avatar
  • Offline
  • Senior Member
  • Posts: 57
  • Thank you received: 16
  • Karma: 7
Hi all,

I am trying to add custom attributes to an element generated with JDom. How do I go about that?
For example, I have a radio button and I want to add an attribute 'data-col-classes="test"' to the html element. I was thinking to use the selectors array, something like this:
                    <?php
                    echo JDom::_('html.form.input.radio', array(
                        'domId' => 'hsmOTPriority',
                        'dataKey' => 'hsmOTPriority',
                        'labelKey' => 'text',
                        'list' => $this->lists['select']['priority']->list,
                        'listKey' => 'value',
                        'selectors' => array(
                                'data-col-classes' => 'test'
                        )
                    ));

But that does not seem to work. Am I doing something wrong or should I achieve this in a different way?

Thanks,

Misha
The administrator has disabled public write access.

JDom and custom attributes 19 Sep 2013 12:57 #11126

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
This is not working in that case because radio is a list of items.

If you want to apply different attributes on radios, then you must customize your JDom class.
But wait a moment because the coming upgrade has changed things in radios.

Stay in touch...
Coding is now a piece of cake
The administrator has disabled public write access.
The following user(s) said Thank You: blue-canoe

JDom and custom attributes 23 Sep 2013 23:01 #11171

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
Have a look in the new v2.6
Radios are now bootstrap buttons.

see
JDom : html.fom.input.select.state

There you can customize inside.
You can also create your own custom colors, icons and static values...
Because selectors are not applied on radios, because radio does not have container. Only labels and radio inputs.
Coding is now a piece of cake
The administrator has disabled public write access.
Time to create page: 0.082 seconds

Get Started