1. Hugh is now back at work, more or less full time, after a slower than expected recovery from his neck surgery early this month. Obviously we have a backlog of support to clear, and are working as hard as we can to take care of it. If you have an unanswered thread more than 3 days old, please post one (and only one) "bump" on it, to move it in to our "last 3 days" list. If you have an unanswered issue in a forum you no longer have access to due to subscriptions timing out, please use the Contact Us form, and provide us with the URL to the thread.

database join element/pre-select value

Discussion in 'Subscriber Support' started by treofan, Aug 31, 2007.

Thread Status:
Not open for further replies.
  1. treofan New Member

    Level: Standard
    Hello,

    I'm using a database join element in one of my tables. When adding a new record to the table I can select a value from the drop down list and the value is also displayed later in the table view.

    My problem now is the following:
    When I edit an existing record, the element doesn't display the value which I selected before but 'Please select'. That means I have to select the right value again. Is it not possible to have the element displaying the value according to the record as a pre-selection? Where can I change it?

    Cheers,
    Marcus
  2. cheesegrits Support Gopher

    Level: Community
    Strange, that should be the default behavior. I just double checked on some of my forms, and the joined dropdowns retain their value when editing the forms, or viewing them in tables.

    Check your fabrik.class.php, around line 898 in getForeignKeyDropDowns(), should be ...

    Code (text):
                                $default = $group->getElementDefaultValue( $el, $elementData, $this, $editable );
                                if( $el->canUse( ) ){
                                    /*if user can access the drop down*/
                                   
                                    if( $displayType == "dropdown" ){
                                        $dropdown = mosHTML::selectList( $tmp, $_elHTMLName, 'class="inputbox" size="1" ', 'value', 'text', $default );
                                    } else {
                                        $dropdown = fabrik_html_content::radioList( $tmp, $_elHTMLName, 'class="inputbox" size="1" ', $default,'value', 'text' );
                                    }
                                } else {
    The dropdown is built using the standard Joomla mosHTML::selectList() function, which automagically selects the $default, if that value is found in the values. You might try putting a var_dump() in right after it fetched the default. So right after the first line above, put:

    Code (text):
    echo 'default: '; var_dump($default); echo '<br />';
    ... and see what it prints out when you display the form again.

    -- hugh
  3. treofan New Member

    Level: Standard
    Hi Hugh,

    thanks for your help. At least I couldn't fix the error but now I know where it comes from:

    I joined 2 tables together and used for one of the fields in the second table a join dropdown.

    That seems to confuse fabrik as it gives back a zero value as default when editing the record.
    If I use the join dropdown in the first table everything works fine.

    Any suggestions how to solve the problem?

    Cheers,
    Marcus
  4. rob Administrator

    Level: Community
    Hi Marcus

    This *should* be fixed in rev 184 of the SVN. Could you test it out and let me know if it solves your problem?

    Rob
  5. treofan New Member

    Level: Standard
    Hi Rob,

    it's fixed now. Thanks for you help.

    Cheers,
    Marcus
Thread Status:
Not open for further replies.

Share This Page