Success

User tests: Successful: Unsuccessful:

avatar Bakual
Bakual
6 Mar 2014

Issue

There is a phpcs issue with the signature of JHtmlSelect::suggestionlist(). It contains a required $idtag after the optional $optkey and $optText, which essentially makes those two required as well.

Fixing this correct is basically not possible without creating a new function and proxy it.

The produced datalist also has some errors in it.

Solution

  • This PR will deprecate JHtmlSelect::suggestionlist() which was introduced with J3.2 to implement the <datalist> tag into the text formfield.
  • The datalist will be created directly in the getInput() function of the formfield instead. It's a very simple code and the current usage of JHtmlSelect::options() within JHtmlSelect::suggestionlist() to generate the items created more problems and was basically overkill.
  • Deprecated getSuggestions() in the text formfield and replaced it with getOptions() like we use in every other formfield. getSuggestions() is proxied to getOptions() in case someone was extending the class and actually used it.

Testing

Add some options to a text field and see if the datalist works. For example change the title for the article form to

        <field name="title" type="text" label="JGLOBAL_TITLE"
            description="JFIELD_TITLE_DESC"
            class="input-xxlarge input-large-text"
            size="40"
            required="true" 
            >
            <option>Option1</option>
            <option value="Value2">Option2</option>
            <option value="Value3" />
        </field>

It should show a list with "suggestions" as soon as you start typing or click into the field.
Please note that the first option will not show because there is no value given. The second option will show with both the value and the text, depending on browser (Chrome shows the text rigth aligned a bit smaller). The third option will show the value only.

Remarks

This is based on a Codestyle PR and some discussions we had after it.
Unfortunately I forgot to do the PR then and now can't find the discussion anymore.

avatar Bakual Bakual - open - 6 Mar 2014
avatar phproberto
phproberto - comment - 7 Mar 2014

:+1:

In a perfect world datalist lines would be tabbed & splitted in different lines ( adding "\t" & "\n" to lines). But we can wait for layouts to do that.

avatar Bakual
Bakual - comment - 7 Mar 2014

Yeah, layouts will make that easy :+1:

avatar Bakual
Bakual - comment - 12 May 2014

Pfft, rebasing against staging branch when PR is against 3.3-dev isn't going to work. :)

avatar Bakual Bakual - change - 12 May 2014
Status New Closed
Closed_Date 0000-00-00 00:00:00 2014-05-12 14:17:54
avatar Bakual Bakual - close - 12 May 2014
avatar Bakual Bakual - close - 12 May 2014

Add a Comment

Login with GitHub to post a comment