TOPIC:

Action Script Select List BreezingForms dependiente desde BBDD 1 week 6 days ago #260202

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 6113
  • Karma: 3
  • Thanks: 432
Hi,

got it.

Use this code in Customer select list:
function ff_Customer_action(element, action)
{
    switch (action) {
        case 'change':
            jQuery.ajax({
                type: "POST",
                
                url: "<?php return JURI::root(true ); ?>/Select_list_Customer_Model.php",
                data: { code: ff_getElementByName('Customer').value},    
                success: function(data) {
                var obj = JSON.parse(data);
                var result = [];

    var keys = Object.keys(obj);
    keys.forEach(function(key){
        result.push(obj[key]);

    });
                        jQuery('#ff_elem370').empty();
                       
                       jQuery('#ff_elem370').append(jQuery('<option>', {
                                value: '',
                                text: 'Choose option'
                            }));
                       for (var i = 0; i < result.length; i++) { 
                           console.log(result[i]);
                           jQuery('#ff_elem370').append(jQuery('<option>', {
                                value: result[i],
                                text: result[i]
                            })); 
                        }
                }      
            });
            break;
        default:;
    } // switch
} // ff_Customer_action
then go to php file Select_list_Customer_Model.php, and replace previous code with this:
<?php

define('_JEXEC', 1);
if (file_exists(__DIR__ . '/defines.php'))
{
    include_once _DIR_ . '/defines.php';
}
if (!defined('_JDEFINES'))
{
    define('JPATH_BASE', __DIR__);
    require_once JPATH_BASE . '/includes/defines.php';
}
require_once JPATH_BASE . '/includes/framework.php';


$db = JFactory::getDBO(); 

$code=$_POST['code']; // the value posted from the AJAX request above

$db = JFactory::getDBO();

$db->setQuery("Select Model From jos_Projects Where Customer = '$code' ");


$row =$db->loadColumn();
 if(!$row){
 	echo "error";
} else {

	echo json_encode($row);
}

?>

The only thing you should check is the ID of second select list (#ff_elem370), I think it is ok, but please check it again for security.

I tested this code on my server, and it works ok:


Let me know if you get in stuck

Regards,
Tihana
Attachments:

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

Last edit: Post by tihana.krivic.

Action Script Select List BreezingForms dependiente desde BBDD 1 week 4 days ago #260343

  • Topic Author
  • shenares
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 37
  • Thanks: 0
Hi,

Thanks for the response.

We continue with the same problem. It shows strange code like the image. I copy this code. If you want, you can connect to my web server.

BR,
Attachments:

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

Action Script Select List BreezingForms dependiente desde BBDD 1 week 4 days ago #260345

  • Mirec's Avatar
  • Mirec
  • Offline
  • Expert Breezer
  • Expert Breezer
  • Posts: 222
  • Karma: 2
  • Thanks: 4
Hi,

could you please send me login information, backend link, FTP access, and if you can access to your database on email ma@evolutio.hr

I'll connect to your server and solve your problem.

For your test,
in the attached file I sending you an example that I created for you and which I tested by myself and everything working well.
In the zip file, you will find a PHP file that needs put in the Joomla root.

Please download->unzip->and install it (BF->Configuration->Package Installer->select this xml file->Install Package).

Regards!
Mirko

File Attachment:

File Name: mypck_00117.zip
File Size:11 KB
Attachments:

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

Last edit: Post by Mirec.
Moderators: ForumSupport
Time to create page: 0.102 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!