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).
The option name is passed, rather than the value (to continue the example above, '1 Month' is passed rather than '1'.
J3.5.1, Windows 10, PHP 5.6, Apache 2.4
I've now updated the site in question to 3.6.1, and the issue remains.
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.
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...
I think we've all had one of those days
Labels |
Added:
?
|
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
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'...
Category | ⇒ | Fields |
Seem the JS logic was to use the text as value:
https://github.com/joomla/joomla-cms/blob/staging/media/system/js/combobox-uncompressed.js#L134-L135
I guess one could either update the docs and leave it as is, or..
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/
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:
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.
Category | Fields | ⇒ | Documentation Fields |
Status | New | ⇒ | Confirmed |
I am looking at this at the bugsquad session at JAB2017
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.
I am going to close this
Status | Confirmed | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-06-04 08:18:45 |
Closed_By | ⇒ | brianteeman |
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