Welcome, Guest
Username: Password: Remember me

TOPIC: Two information in a combobox

Re: Two information in a combobox 28 Nov 2012 13:35 #5677

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
You can now use {field_name}, instead of <%fieldname%>, much better ;-)

And can be done in XML.

FKeys or any other var can be used as well, since they are initializated in the object.
Coding is now a piece of cake
The administrator has disabled public write access.

Re: Two information in a combobox 28 Nov 2012 13:37 #5678

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
In your grid, you are wrong.

Do not use 'dataKey', but 'labelKey'.
Totally different.

dataKey is used to catch the value,
labelKey, is for the final visualization parsing.
Coding is now a piece of cake
The administrator has disabled public write access.

Re: Two information in a combobox 28 Nov 2012 13:50 #5680

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 64
Hi @admin,

Thanks for the response but it's not working for me!

<%title%> (<%alias%>)

Just to clarify, is the only element that should be passed 'labelKey' => '<%title%> (<%alias%>)' or 'labelKey' => '{title} ({alias})' because, with the code
<?php echo JDom::_('html.fly', array(
	'dataKey' => '_finish_title',
	'dataObject' => $row,
	'labelKey' => '<%title%> (<%alias%>)',
	'link_title' => $row->_finish_title,
	'route' => array('view' => 'finish','layout' => 'finish','cid[]' => $row->finish)
));?>
It is not working.

Thanks,

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The administrator has disabled public write access.

Re: Two information in a combobox 28 Nov 2012 14:01 #5681

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
Sorry. I made a mistake.

dataKey. Not labelKey.
In 'html.fly', use 'dataKey'


both <%%> and {} should work.
No ?
Coding is now a piece of cake
The administrator has disabled public write access.

Re: Two information in a combobox 28 Nov 2012 14:03 #5682

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 64
Neither worked, I was only getting a white page. I've rebuilt my component since you just did maintenance and am just about to retest it with new updated code.

Will let you know in a couple of mins...

Thanks,

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The administrator has disabled public write access.

Re: Two information in a combobox 28 Nov 2012 14:07 #5683

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
I could also manage it for link_title, but I should use another parameter name for compatibility with previous versions...

For the moment link_title is not using it.
Coding is now a piece of cake
The administrator has disabled public write access.
The following user(s) said Thank You: JoomGuy

Re: Two information in a combobox 28 Nov 2012 14:18 #5684

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 64
Hi @admin,

OK, got it working in grid but, cannot get it to work in the combobox itself when in a form.

Any advice?

Thanks,

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The administrator has disabled public write access.

Re: Two information in a combobox 28 Nov 2012 14:40 #5685

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
In combobox, use 'labelKey'.
It works in my hand.

Do you want to same feature for title ?
Coding is now a piece of cake
The administrator has disabled public write access.
The following user(s) said Thank You: JoomGuy

Re: Two information in a combobox 28 Nov 2012 14:41 #5686

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 64
Thanks @admin!

Got it working perfectly! Don't know what was happening but now it just works! :woohoo:
$field = $fieldSet['jform_section'];
$field->jdomOptions = array(
			'list' => $this->lists['fk']['section'],
			'labelKey' = '{title} {alias}'
		);
It's not working at all in the combo

Thanks,

G
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
Last Edit: 28 Nov 2012 15:58 by JoomGuy. Reason: Working all of a sudden!
The administrator has disabled public write access.

Re: Two information in a combobox 28 Nov 2012 17:41 #5687

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 64
Sorry to bother you again Jocelyn,

I just wondered how to handle adding additional related fields when using ajax combo and groupby? Could you please demonstrate?

Here's the jDom code for my Category field:
// Category
$field = $fieldSet['jform_category'];
$field->jdomOptions = array(
	'ajaxVars' => array('values' => array(
		$this->item->category))
);
many thanks,

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The administrator has disabled public write access.

Re: Two information in a combobox 01 Dec 2012 10:02 #5696

  • dave1167
  • dave1167's Avatar
  • Offline
  • New Member
  • Posts: 10
  • Karma: 0
This is great been trying to get two fields in the combo box for several days now and solved by reading this post :P

I can't get the grid to work This is the code with just a surname in
<?php echo JDom::_('html.fly', array(
												'dataKey' => '_race_officer_surname_surname',
                                                                                               	'dataObject' => $row
												));
				?>

Should I be using the following
<?php echo JDom::_('html.fly', array(
					'labelKey' => '{ _race_officer_forename_forename} { _race_officer_surname_surname}',
                                                                                               	'dataObject' => $row
												));
				?>

Or is it
<?php echo JDom::_('html.fly', array(
					'labelKey' => '{forename} {surname}',
                                     	'dataObject' => $row
												));
				?>
The administrator has disabled public write access.

Re: Two information in a combobox 01 Dec 2012 18:09 #5701

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 64
Hi there,

use dataKey instead of labelKey in your last example like;
<?php echo JDom::_('html.fly', array(
	'dataKey' => '{forename} {surname}',
        'dataObject' => $row
));
?>
Hope it helps!

Gez

PS I'm glad it wasn't only me baffled by this :blush:
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The administrator has disabled public write access.

Re: Two information in a combobox 01 Dec 2012 18:39 #5703

  • VeCrea
  • VeCrea's Avatar
  • Offline
  • Platinum Member
  • Absolute JCook fan
  • Posts: 473
  • Thank you received: 100
  • Karma: 30
And there goes Michael Jackson singing "YOu are not alone... i am here with youuuuu" ;)
The administrator has disabled public write access.

Re: Two information in a combobox 02 Dec 2012 06:07 #5706

  • dave1167
  • dave1167's Avatar
  • Offline
  • New Member
  • Posts: 10
  • Karma: 0
Apologies for being dumb here, I am still new to cook book but still can't it to work in the grid.
Here is the code I am using
<?php           echo JDom::_('html.fly', array(
				'dataKey' => '{forename} {surname}',
				'dataObject' => $row
				));
				?>

The field in the grid just shows blank

Do I need to do anything else, somewhere else in the code?

I notice one of the earlier posts mentioned the XML forms, but the code that cookbook generated doesn't have any XML forms other than access config and the install file. I have tried building the project using different configurations but still no success.

Thanks for your help
Last Edit: 02 Dec 2012 06:08 by dave1167.
The administrator has disabled public write access.

Re: Two information in a combobox 02 Dec 2012 15:05 #5728

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
Try on a fresh generated install. (Upgrade JDom), or use <% %>.

This is absolutly working for me.

html.fly => use 'dataKey'
html.form.input.select => use 'labelKey'
Coding is now a piece of cake
The administrator has disabled public write access.
Time to create page: 0.129 seconds

Get Started