?
avatar paul-muckypuddle
paul-muckypuddle
4 Aug 2016

Steps to reproduce the issue

  1. Define a 'combo' form field type in an XML form
  2. Access the view containing that form
  3. Submit the form
  4. View the submitted data

Expected result

The value of the bound field should match the value in the XML - e.g. the following field definition:

<field name="period" type="combo">
  <option value="1">1 Month</option>
  <option value="2">2 Months</option>
</field>

should pass 1 to the model on submission, not '1 Month' (should that value be selected).

Actual result

The option name is passed, rather than the value (to continue the example above, '1 Month' is passed rather than '1'.

System information (as much as possible)

J3.5.1, Windows 10, PHP 5.6, Apache 2.4

Additional comments

avatar paul-muckypuddle paul-muckypuddle - open - 4 Aug 2016
avatar brianteeman
brianteeman - comment - 4 Aug 2016

Before preceding any further please ensure you are in the latest release of Joomla we are now on za 3.6.1 which has hundreds of fixes in since the release of your 3.5.1

avatar paul-muckypuddle
paul-muckypuddle - comment - 4 Aug 2016

I've now updated the site in question to 3.6.1, and the issue remains.

avatar brianteeman
brianteeman - comment - 4 Aug 2016

Always important to ensure that you are on the latest release and I
wouldn't have wanted to waste peoples time helping you if it had already
been fixed.

avatar paul-muckypuddle
paul-muckypuddle - comment - 4 Aug 2016

Apologies, didn't mean to come across as snarky there - still at my desk after a long day - you're quite right, I should have updated before posting an issue :) Just doing a bit of rummaging in the code here at my end to see what's what...

avatar brianteeman
brianteeman - comment - 4 Aug 2016

I think we've all had one of those days

avatar brianteeman brianteeman - change - 4 Aug 2016
Labels Added: ?
avatar brianteeman
brianteeman - comment - 4 Aug 2016

I've never used this field type myself and its not used in the core. But reading this https://books.google.co.uk/books?id=o68lyZWZDJQC&pg=PT237&lpg=PT237&dq=joomla+combo+form+field+type&source=bl&ots=okZs0QLN_F&sig=abjRQ8DlMBzKkCayjmqpBIHwBTo&hl=en&sa=X&ved=0ahUKEwjvwP3byajOAhXDBsAKHSqeAg84ChDoAQhVMAk#v=onepage&q=joomla%20combo%20form%20field%20type&f=false it looks to me that it either doesnt work properly or the documentation is wrong but no one has reported it before.

Hopefully someone with more development skill than me can help further but I just wanted to give you some sort of quick reply

avatar paul-muckypuddle
paul-muckypuddle - comment - 4 Aug 2016

That's grand, appreciate you looking into this.

Such a handy form field type as well - once this project is out of the way I may try fixing it up to behave as one would expect. It does render a drop down list with the standard Bootstrap caret button and a text field, so things look like they've progressed a little since the book.

That all said, any potential fix may come as an unpleasant surprise if people using it currently with the 'broken' behaviour then suddenly have it start 'working'...

avatar brianteeman brianteeman - change - 4 Aug 2016
Category Fields
avatar Devportobello
Devportobello - comment - 5 Aug 2016
avatar paul-muckypuddle
paul-muckypuddle - comment - 5 Aug 2016

I guess one could either update the docs and leave it as is, or..

  • update the field code to output the XML option value as a data attribute in the HTML, as it's currently not used at all
  • update the form field type definition with a new parameter that allows the user to specify which value to use (option text / option value), with the default being 'text' for backwards compatibility
  • pass the value specified by the parameter above on submit
avatar brianteeman
brianteeman - comment - 5 Aug 2016

Isnt a combobox supposed to take its value from the selected text because
you can enter your own value into a combobox

So I think it is a case of the documentation being wrong

it should be < option>text
not < option value=1>text

On 5 August 2016 at 09:12, Paul Holmes notifications@github.com wrote:

I guess one could either update the docs and leave it as is, or..

  • update the field code to output the XML option value as a data attribute in the HTML, as it's currently not used at all
  • update the form field type definition with a new parameter that allows the user to specify which value to use (option text / option value), with the default being 'text' for backwards compatibility
  • pass the value specified by the parameter above on submit


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#11458 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABPH8dtTPHiKlYL1qNV9f8oOiQHia306ks5qcvBbgaJpZM4JdDO7
.

Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/

avatar paul-muckypuddle
paul-muckypuddle - comment - 5 Aug 2016

AFAIK a combobox should be the text if you enter your own value, and the option value if an existing value is selected - for example:

  • Bootstrap Combobox - in the how to use it section, there are standard options with values, as well as the ability to enter your own
  • Kendo UI Demo - in the demo, selecting an existing option in the 'Fabric' drop down, then clicking Customize, shows the option value rather than name. Typing in your own shows the typed in value.

That said, there aren't a ton of combobox widgets out there (I was surprised to find one baked into Joomla), which I find quite surprising given how versatile they are.

avatar brianteeman brianteeman - change - 7 Aug 2016
Category Fields Documentation Fields
avatar brianteeman brianteeman - change - 7 Aug 2016
Status New Confirmed
avatar GeraintEdwards
GeraintEdwards - comment - 3 Jun 2017

I am looking at this at the bugsquad session at JAB2017

avatar paul-muckypuddle
paul-muckypuddle - comment - 3 Jun 2017

Been a little while since I looked at this - my only points would be because a) the other comboboxes I referenced do so, and b) it feels instinctively odd that what is essentially an HTML select element wouldn't have the ability to have a display value (text) and actual value (option value) - even if users can type in their own 'option' where both of those would be the same.

My usecase for this at the time was for a report builder I was making, where the "default" options would be for picking a well-defined report type (that had templates, rules, support etc), but typing in an option allowed for ad-hoc report types. Later, if the same ad-hoc report types were appearing again and again we could build it into a fully fledged 'type' (with said templates etc) and add it as "default" option.

Now that that part of project is over and paid for I can't see myself getting stuck over this, so happy to have it closed if considered not a bug.

avatar brianteeman
brianteeman - comment - 4 Jun 2017

I am going to close this

avatar brianteeman brianteeman - change - 4 Jun 2017
The description was changed
Status Confirmed Closed
Closed_Date 0000-00-00 00:00:00 2017-06-04 08:18:45
Closed_By brianteeman
avatar brianteeman brianteeman - close - 4 Jun 2017

Add a Comment

Login with GitHub to post a comment