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.095 seconds

Freakin' Awesome!!! J-Cook is simply awesome - whether you're a highly experienced developer or complete novice whether you're building a small inventory component or a complete community solution! The beauty comes from a fast slick and reliable platform that readily provides developers with everything they'll need to build the backbone of a solid and secure component with wizards for authoring access publishing aliasing created/modified by dates... you name it COOK provides it! J-Cook really surpasses all of the 'competition' as far as MVC tools are concerned! Try love it and get cooking!
learnthrusong (JED)
          

Get Started