Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

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

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

Please Log in or Create an account to join the conversation.

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

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
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 following user(s) said Thank You: blue-canoe

Please Log in or Create an account to join the conversation.

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

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
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

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.077 seconds
  let me say what a brilliant app! Thank you very very much for all the hard work to build Cook!
Tocpe (Forum)

Get Started