different label in list and form view for dbjoin element

Status
Not open for further replies.

jnskst

New Member
Hello, I am looking for a possibility to have a different label for a dbjoin element in list and form view. How can I realize this?

e.g. I have a dbjoin element dropdown with a label let say "In Progress" the value is "IP" How can I use the value "IP" for the list view and "IN PROGRESS" for the form(edit) view?

regards

jnskst
 
You could use the 'eval options' option. So if the label is usually IP by default, your options eval might look like:

PHP:
if ($o->text == 'IP' && JRequest::getVar('view') == 'form')
{
    $o->text = "IN PROGRESS";
}

If your label is usually IN PROGRESS, not IP, just switch them around in the above code.

-- hugh
 
Hello Hugh, at first , thanks for the quick reply on that. I tried that out and it works, but only for one value. As I wrote its a dbjoin element and the target table has three columns. id, status_code and status. The value for the join is the id, the lable in the form dropdown should be the status column, and for the list view I need the status_code column. Is there a way to make it more simple and that I can be sure that there is no manual work needed if I have one day additional records in that joined table?

regards

Jens
 
You could add a cascading drop down element, watching the dbjoin, label= status_code; hidden in form/details, show in list
 
ok thanks, but..

Hello I will do this, but I had the hope to avoid to add an additional field to the form. I have already to much field, this will slow down my performance.

anyway, thanks for the quick support

best regard
jnskst
 
Maybe it's possible to do it in the eval options Hugh mentioned: catching the label directly from the database table
Code:
db =&JFactory::getDBO();
 $db->setQuery("SELECT status from your-dbjoin-table where id=$o->value"); 
$o->text = $db->loadResult();

or did you try to set label = status_code and description field=status?
 
fixed for the first time

Hello Guys,
I decided to use the hidden cascadingdropdown to fix it for the first time.

Thanks again for the great support!

regards

jnskst
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Staff online

Members online

Back
Top