1. Hugh (cheesegrits) here. Thank you for all the good wishes. My back surgery was a success, post-op recovery is going well, and I'm getting stronger and feeling better every day. I hope to be getting back in the saddle and working support again over the next few days.
  2. IMPORTANT NOTE - we have made some changes in our github branch naming. The 'master' branch no longer exists, and is now called 'joomla25' (which is Fabrik 3.0). The 'joomla3' branch (which is Fabrik 3.2) remains unchanged. We have also removed all the other testing branches which had accuulated over the last few years. I have posted a thread in the Community forum for 3.0 with some more information, feel free to as questions there.

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