Success

User tests: Successful: Unsuccessful:

avatar okonomiyaki3000
okonomiyaki3000
14 May 2013

Allows you to create <option> tags for JFormFieldList or any class that inherits from it which basically function exactly like JFormFieldSQL. This essentially makes JFormFieldSQL obsolete and adds its functionality to all classes that extend JFormFieldList. And, since it's built on top of #1115, that means you can create checkbox or radiobutton inputs based on SQL.

An example of the sql field type from the wiki (http://docs.joomla.org/SQL_form_field_type) looks like this:

<field name="title" type="sql" default="10" label="Select an article" query="SELECT id AS value, title FROM #__content" />

But could now be rewritten as:

<field name="title" type="list" default="10" label="Select an article">
    <option type="sql" query="SELECT id AS value, title FROM #__content" />
</field>

Which might not seem better except you can also do this:

<field name="title" type="checkboxes" label="Select some articles">
    <option type="sql" query="SELECT id AS value, title FROM #__content" />
</field>

Also, I've added this:

<field name="title" type="checkboxes" label="Select some articles">
    <option type="sql" query="SELECT id AS value, title FROM #__content" >
        <query driver="mysqli" query="SELECT `id` AS `value`, `title` FROM `#__content`" />
        <query driver="sqlsrv" query="SELECT [id] AS [value], [title] FROM [#__content]" />
    </option>
</field>

Which makes it so that the option's query will be used by default but, if there is a query for the specific database driver being used, that one will be used instead.

avatar okonomiyaki3000 okonomiyaki3000 - open - 14 May 2013
avatar elinw
elinw - comment - 14 May 2013

I've never understood why rather than query you wouldn't have table, value and text attributes (and maybe optionally distinct) in the sql type. Do you not care about the distinct issue? I really like the driver handling.
I definitely favor a better way of handling sql than the sql field provides and this looks powerful.

avatar okonomiyaki3000
okonomiyaki3000 - comment - 14 May 2013

Ah, I think I get what you're saying. I could add something like this:

<field name="title" type="checkboxes" label="Select some articles">
    <option type="table" table="#__content" value="id" text="title" />
</field>

Not as flexible as a query but very simple and it's no trouble to have both.

avatar okonomiyaki3000
okonomiyaki3000 - comment - 15 May 2013

Done. I'm using value_field and key_field as the attribute names for consistency.

avatar okonomiyaki3000
okonomiyaki3000 - comment - 15 May 2013

I suddenly had an idea of how a future version of this could be made more awesome but I'll leave it alone for the moment.

avatar elinw
elinw - comment - 28 May 2013

That's so cool! Thanks.

avatar okonomiyaki3000
okonomiyaki3000 - comment - 28 May 2013

This is not bad. But this is much better #1192

avatar brianteeman
brianteeman - comment - 13 Oct 2013

Thanks for your contribution - At this time we are only using github as the place to submit code fixes, the actual reporting of issues and testing fixes is still taking place on Joomlacode.

As it has been some time since you opened this issue can you please confirm that it is still valid with the current Master or Joomla 3.2 beta. If it is no longer valid then please can you close this issue. Otherwise please can you:

1) Open an item on the Joomlacode tracker in the appropriate area.

CMS Bug Reports: http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemBrowse&tracker_id=8103

CMS Feature Requests: http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemBrowse&tracker_id=8549

2) After submitting the item to the Joomlacode tracker, add a link to the Joomlacode tracker item here and make sure that you add a link to this GitHub issue or pull request on the joomlacode tracker item.

avatar okonomiyaki3000 okonomiyaki3000 - close - 15 Oct 2013
avatar okonomiyaki3000
okonomiyaki3000 - comment - 15 Oct 2013

I'm closing this request because #1192 is better in every possible way.

Add a Comment

Login with GitHub to post a comment