Welcome, Guest
Username: Password: Remember me

TOPIC: [SOLVED] dataValue on COMBO Jdom input

dataValue on COMBO Jdom input 09 Jul 2013 11:14 #7928

  • Tomaselli
  • Tomaselli's Avatar
  • Offline
  • Elite Member
  • Posts: 293
  • Thank you received: 87
  • Karma: 46
This is not a real bug, but it gives some problems as shown below.
on file:
dom\html\form\input\select\combo.php

on line 216:
$selected = ($item->$listKey === $this->dataValue);

IF I previously pass a "dataValue" using the jdomOptions AND my purpose is to set a value to a combo list field for a foreign key (the datakey is an integer), THEN when "$selected" value should be matched it still gives FALSE.

this is due to the PHP comparison operator "===", the variable type of $item->$listKey is recognized as string and it should be an integer.

I don't know if in this case the indentical comparison operator should be really used , in my opinion the simple equal operator could be enough, I leave to the admin further investigations.
In my case I just changed it to, and it doesn't give me any problems, until now:
$selected = ($item->$listKey == $this->dataValue);
Last Edit: 09 Jul 2013 11:38 by Tomaselli.
The administrator has disabled public write access.

dataValue on COMBO Jdom input 21 Jul 2013 11:25 #10543

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
Yes it is very important for filters for example.
Because 0 is different than ""

Suggestion :

Reformate the value using
'dataValue' => (int)$this->item->myfield //Parse to integer
...
or
'dataValue' => (string)$this->item->myfield //Parse to string


with dataValue you define the value directly.

Hope it helps.
Coding is now a piece of cake
The administrator has disabled public write access.
The following user(s) said Thank You: Tomaselli

dataValue on COMBO Jdom input 23 Jul 2013 00:04 #10552

  • Tomaselli
  • Tomaselli's Avatar
  • Offline
  • Elite Member
  • Posts: 293
  • Thank you received: 87
  • Karma: 46
thanks for the reply. I didn't think about that.
Yes, it's needed and thanks for the advice, you saved me to fix this probable bug later.
by the way I saw some of the attributes are not enabled yet on all the type fields, there is a specific reason for that, or it's just because you didn't use them yet?
The administrator has disabled public write access.
Time to create page: 0.058 seconds

Get Started