Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NFR]: No way to add html attributes to Select Tag. documentation inadequate #315

Open
zhangster opened this issue Jan 19, 2023 · 1 comment
Labels
new feature request Planned Feature or New Feature Request

Comments

@zhangster
Copy link

This seems like a really basic feature that's missing. for instance, i can't even have a select tag with css classes since there's no way to add attributes to the tag. somehow you can add classes to other html tags? this needs to be more consistent

@zhangster zhangster added the new feature request Planned Feature or New Feature Request label Jan 19, 2023
@borisdelev
Copy link
Sponsor

borisdelev commented Jan 20, 2023

@zhangster how you use select tag, couse i see in documentation way to add more attributes...
(maybe you talk about version phalcon 5?)
In doc (see options):

<?php

use Phalcon\Html\Escaper;
use Phalcon\Html\Helper\Input\Select;

$escaper = new Escaper();
$helper  = new Select($escaper);

$options = [
    'id' => 'carsList',
];
 
$result = $helper('    ', PHP_EOL, $options);
$result
    ->add("Ferrari", "1", ["class" => "active"])
    ->add("Ford", "2")
    ->add("Dodge", "3")
    ->add("Toyota", "4")
    ->optGroup(
        'oneLabel',
        [
            'class' => 'form-input',
        ]
    )
    ->addPlaceholder(
        'Choose & Car...',
        "0",
        [],
        true,
    )
    ->selected("3")
;

echo $result;
//
//    <select id="carsList">
//        <optgroup class="form-input" label="oneLabel">
//            <option value="0">Choose & Car...</option>
//            <option value="1" class="active">Ferrari</option>
//            <option value="2">Ford</option>
//            <option value="3" selected="selected">Dodge</option>
//            <option value="4">Toyota</option>
//        </optgroup>
//    </select>"

In zep file: https://github.com/phalcon/cphalcon/blob/master/phalcon/Html/Helper/Input/Select.zep

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature request Planned Feature or New Feature Request
Projects
None yet
Development

No branches or pull requests

2 participants