TOPIC:

mysql database query in element (select from list) 1 year 7 months ago #232350

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 413
Hello,

The value.php file seems fine.
Please send me backend login info to your site to mihaela.kobovac@crosstec.org so I can take a look at your form and try to figure out why it is not working.

In the email write the name of form that I should look at.

Regards,

Mihaela

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

mysql database query in element (select from list) 1 year 7 months ago #232355

  • Topic Author
  • mlangamer
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 24
  • Thanks: 0
Just sent

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

mysql database query in element (select from list) 1 year 7 months ago #232357

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 413
Hello,

Thank you for the credentials.

I will take a look at this and get back to you as soon as possible.

Regards,

Mihaela

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

mysql database query in element (select from list) 1 year 7 months ago #232361

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 413
Hello,

I've changed the Actionscript and now it is working but only for some select list options or it might be that for some values there aren't any Vagas disponíveis.
Please test the form yourself and let me know whether it returns the correct values.

Also, check whether you have entered the correct values in select list.

I've used the following script:
function ff_tipo_vaga_action(element, action)
{
    switch (action) {
        case 'change':
            jQuery.ajax({
                type: "POST",
                url: "http://www.sistemas.ti.educacaoluziania.go.gov.br/consulta2.php",
                data: { tipo_vaga: element.value },    
                success: function(data) {
                var obj = JSON.parse(data);
                        jQuery('#ff_elem381').empty();
                       var arr = obj;
                       jQuery('#ff_elem381').append(jQuery('<option>', {
                                value: '',
                                text: 'Choose option'
                            }));
                       for (var i = 0; i < arr.length; i++) { 
                           console.log(arr[i]);
                           jQuery('#ff_elem381').append(jQuery('<option>', {
                                value: arr[i],
                                text: arr[i]
                            })); 
                        }
                }      
            });
            break;
        default:;
    } // switch
} // ff_tipo_vaga_action

NOTE: I see that you are using ajax request on "consulta2.php" file, not "value.php". I assume that you've decided to change the file's name, but I wanted to note that just in case.

Regards,

Mihaela

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

mysql database query in element (select from list) 1 year 7 months ago #232379

  • Topic Author
  • mlangamer
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 24
  • Thanks: 0
Mihaela, it's working perfectly!
Thank you very much!
I know this help is helping other users as well.
Please tell me what was wrong?

I still need to make 2 adjustments that are, when selected
• Bring the contents of the QUANTIDADE_DE_VAGAS column to the VAGA element
• Bring the contents of the EMAIL_ESCOLA column to the EMAILESCOLA element

And if possible show me how I can add to the VAGAS DISPONÍVEIS result in the selection
In addition to the school, add another column together that would be QUANTIDADE_DE_VAGAS

Example:
EVA MARRA ROCHA - 20 VAGAS

Thank you in advance.

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

mysql database query in element (select from list) 1 year 7 months ago #232402

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 413
Hello,

I'm really glad that this is working as you wanted.

Actually, I've pasted my script in your Actionscript and adjusted it to your form so I am not sure where was the error in your script.
Therefore I have posted the working script in my previous post so other users can see which script worked in the end.
Thank you for caring about helping the others.

To add QUANTIDADE_DE_VAGAS to the VAGAS DISPONÍVEIS options in select list follow these steps:
1) You have to change the consulta2.php file.
Replace this part of code:
$db->setQuery('SELECT `escola` FROM `vagas` WHERE quantidade_de_vagas > 0 AND serie ='.$db->quote($judgePick)); 
$result = $db->loadColumn();
with this code:
$db->setQuery('SELECT `escola`, `quantidade_de_vagas` FROM `vagas` WHERE quantidade_de_vagas > 0 AND serie ='.$db->quote($judgePick)); 
$result = $db->loadRowList();

2) In Actionscript of tipo_vaga element change this part of code:
 for (var i = 0; i < arr.length; i++) { 
                           jQuery('#ff_elem381').append(jQuery('<option>', {
                                value: arr[i],
                                text: arr[i]
                            })); 
                        }
with this piece of code:
 for (var i = 0; i < arr.length; i++) { 
                           jQuery('#ff_elem381').append(jQuery('<option>', {
                                value: arr[i][0],
                                text: arr[i][0] + ' - ' + arr[i][1] + ' VAGAS'
                            })); 
                        }

Regarding the other part, you would like to fill fields vaga and emailescola depending on which 'escola' is selected in the other Vagas disponíveis select list, is that correct?

Regards,

Mihaela
The following user(s) said Thank You: mlangamer

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

Moderators: ForumSupport
Time to create page: 0.054 seconds

Summer Sale!

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!