TOPIC:

Get other form values fro database 1 year 3 months ago #244335

  • Topic Author
  • mrperfectpz
  • Offline
  • Gold Breezer
  • Gold Breezer
  • Posts: 411
  • Thanks: 0
Sorry Markus I am not very good with coding, can you tell where I need to place it within the code please

Please Log in or Create an account to join the conversation.

Get other form values fro database 1 year 3 months ago #244352

  • TheMuffinMan's Avatar
  • TheMuffinMan
  • Offline
  • Developer
  • Developer
  • Posts: 10064
  • Karma: 167
  • Thanks: 808
Sure, can you please post the current state of the editable prepare code? I will add what I think should work then.

Please Log in or Create an account to join the conversation.

Get other form values fro database 1 year 3 months ago #244354

  • Topic Author
  • mrperfectpz
  • Offline
  • Gold Breezer
  • Gold Breezer
  • Posts: 411
  • Thanks: 0
Ok here is the code:
// ADD TEAMS HERE

// clearing the display element first
        $items["displayElement"]["value"]  = '';

        // getting all element values based on the record id
        $db = JFactory::getDbo();
        $db->setQuery("
            Select s.* 
            From
            #__facileforms_subrecords As s 
            Where 
            s.`name` = 'JoinLeagueID' and
            s.`value`= " . $db->quote( $record_id ) );

        $list = $db->loadObjectList();
        $length = count( $list );

 $all_joins = array();

         for($i = 0; $i < $length; $i++){

             $db->setQuery("
            Select s.* 
            From
            #__facileforms_subrecords As s 
            Where 
            s.`record`= " . $db->quote( $list[$i]->record ) );
                     $all_joins[] = $db->loadObjectList();
          }

$length = count($all_joins);

        if( $length ){

            for($i = 0; $i < $length; $i++){

                // adding all fields I want to display in the displayElement field

              $length2 = count($all_joins[$i]);

              $join_record = 0;

              for($j = 0; $j < $length2; $j++){

                $join_record  = $all_joins[$i][$j]->record;

                switch($all_joins[$i][$j]->name){






                    case 'JoinTeamName':
                        $items["displayElement"]["value"] .= '<div style="font-family: Arial;">'  . $all_joins[$i][$j]->value .'  </div>'  ;       
                       break;

                    case 'Owner':
                        $items["displayElement"]["value"] .= '<div style="font-family: Arial;">'  . $all_joins[$i][$j]->value .' </div>'   ;
                        break;



                     case 'TeamTotal':
                        $items["displayElement"]["value"] .= '<div style="font-family: Arial;">'  . $all_joins[$i][$j]->value .' </div>'   ;
                        break;

                  
                }
              }

$items["displayElement"]["value"] .= 'ID: ' . $join_record . "</br>\n";

                $items["displayElement"]["value"] .= '<div style="border-bottom: solid 1px; border-color: #dddddd;"></div> '    ;





            }
        }


As you can see I have bee playing a little to get the values to display horizontally within a div, im not sure if thats the way to go about it.
Also, how would I add numbers (1-end) to the beginning of each line

Please Log in or Create an account to join the conversation.

Last edit: Post by mrperfectpz.

Get other form values fro database 1 year 3 months ago #244370

  • TheMuffinMan's Avatar
  • TheMuffinMan
  • Offline
  • Developer
  • Developer
  • Posts: 10064
  • Karma: 167
  • Thanks: 808
Hi,

please try this. I had to change the db result-sets being returned as array instead of objects so I can apply ksort() on them.

I also added an incremental number, think you mean this?
// ADD TEAMS HERE

// clearing the display element first
$items["displayElement"]["value"]  = '';

// getting all element values based on the record id
$db = JFactory::getDbo();
$db->setQuery("
            Select s.* 
            From
            #__facileforms_subrecords As s 
            Where 
            s.`name` = 'JoinLeagueID' and
            s.`value`= " . $db->quote( $record_id ) );

$list = $db->loadAssocList();
$length = count( $list );

$all_joins = array();

for($i = 0; $i < $length; $i++){

    $db->setQuery("
            Select s.* 
            From
            #__facileforms_subrecords As s 
            Where 
            s.`record`= " . $db->quote( $list[$i]['record'] ) );
    $all_joins[] = $db->loadAssocList();
}

$length = count($all_joins);

if( $length ){

    for($i = 0; $i < $length; $i++){

        // adding all fields I want to display in the displayElement field

        ksort($all_joins[$i], SORT_NATURAL);

        $length2 = count($all_joins[$i]);

        $join_record = 0;

        for($j = 0; $j < $length2; $j++){

            $join_record  = $all_joins[$i][$j]['record'];

            switch($all_joins[$i][$j]['name']){

                case 'JoinTeamName':
                    $items["displayElement"]["value"] .= '<div style="font-family: Arial;">'  . $all_joins[$i][$j]['value'].'  </div>'  ;
                    break;

                case 'Owner':
                    $items["displayElement"]["value"] .= '<div style="font-family: Arial;">'  . $all_joins[$i][$j]['value'] .' </div>'   ;
                    break;

                case 'TeamTotal':
                    $items["displayElement"]["value"] .= '<div style="font-family: Arial;">'  . $all_joins[$i][$j]['value'] .' </div>'   ;
                    break;

            }
        }

        $items["displayElement"]["value"] .= 'Number: ' . ($i + 1) . "</br>\n";

        $items["displayElement"]["value"] .= '<div style="border-bottom: solid 1px; border-color: #dddddd;"></div> '    ;

        $items["displayElement"]["value"] .= 'ID: ' . $join_record . "</br>\n";

        $items["displayElement"]["value"] .= '<div style="border-bottom: solid 1px; border-color: #dddddd;"></div> '    ;

    }
}

Please Log in or Create an account to join the conversation.

Get other form values fro database 1 year 3 months ago #244379

  • Topic Author
  • mrperfectpz
  • Offline
  • Gold Breezer
  • Gold Breezer
  • Posts: 411
  • Thanks: 0
Thanks for adding the numbers thats great but still no effect on the sorting

As you can see from the screenshot ID's 37, 35 are how it should be but they seem to swap so that team is at bottom
Attachments:

Please Log in or Create an account to join the conversation.

Last edit: Post by mrperfectpz.

Get other form values fro database 1 year 3 months ago #244381

  • TheMuffinMan's Avatar
  • TheMuffinMan
  • Offline
  • Developer
  • Developer
  • Posts: 10064
  • Karma: 167
  • Thanks: 808
Try this
// ADD TEAMS HERE

// clearing the display element first
        $items["displayElement"]["value"]  = '';

        // getting all element values based on the record id
        $db = JFactory::getDbo();
        $db->setQuery("
            Select s.* 
            From
            #__facileforms_subrecords As s 
            Where 
            s.`name` = 'JoinLeagueID' and
            s.`value`= " . $db->quote( $record_id ) );

        $list = $db->loadObjectList();
        $length = count( $list );

 $all_joins = array();

         for($i = 0; $i < $length; $i++){

             $db->setQuery("
            Select s.* 
            From
            #__facileforms_subrecords As s 
            Where 
            s.`record`= " . $db->quote( $list[$i]->record ) . " Order by s.`value`" );
                     $all_joins[] = $db->loadObjectList();
          }

$length = count($all_joins);

        if( $length ){

            for($i = 0; $i < $length; $i++){

                // adding all fields I want to display in the displayElement field

              $length2 = count($all_joins[$i]);

              $join_record = 0;

              for($j = 0; $j < $length2; $j++){

                $join_record  = $all_joins[$i][$j]->record;

                switch($all_joins[$i][$j]->name){






                    case 'JoinTeamName':
                        $items["displayElement"]["value"] .= '<div style="font-family: Arial;">'  . $all_joins[$i][$j]->value .'  </div>'  ;       
                       break;

                    case 'Owner':
                        $items["displayElement"]["value"] .= '<div style="font-family: Arial;">'  . $all_joins[$i][$j]->value .' </div>'   ;
                        break;



                     case 'TeamTotal':
                        $items["displayElement"]["value"] .= '<div style="font-family: Arial;">'  . $all_joins[$i][$j]->value .' </div>'   ;
                        break;

                  
                }
              }

$items["displayElement"]["value"] .= 'ID: ' . $join_record . "</br>\n";

                $items["displayElement"]["value"] .= '<div style="border-bottom: solid 1px; border-color: #dddddd;"></div> '    ;





            }
        }

Please Log in or Create an account to join the conversation.

Moderators: ForumSupport
Time to create page: 0.053 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!