TOPIC:

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

  • Topic Author
  • mlangamer
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 24
  • Thanks: 0
Yes! how do I do that?

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

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

  • Topic Author
  • mlangamer
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 24
  • Thanks: 0
did not work
Attachments:

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

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

  • Topic Author
  • mlangamer
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 24
  • Thanks: 0
Disregard my last message because everything worked out as you did. Now I need to know how to fill in the vacant and e-mail fields depending on which school was selected in the other selection list. Thank you very much my darling . God bless you a lot and a lot

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

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

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

Thank you for the kind words. :)
I'm here to help.

I'm glad that the previous solution did work for you in the end.

To fill in the vacant and e-mail fields depending on which school was selected in the other selection list follow these steps:

1) Go to Advanced properties of second select list "vagas_escola" and in Actionscript section set Type to Custom and check the Change checkbox.
Then in the code area below put the following code:
function ff_vagas_escola_action(element, action)
{
   switch (action) {
        case 'change':
            jQuery.ajax({
                type: "POST",
                url: "http://localhost/value2.php",
                data: { vagas_escola: element.value },    
                success: function(data) {
                var obj = JSON.parse(data);
                var arr = obj;
                ff_getElementByName('vaga').value = arr[0];
                ff_getElementByName('emailescola').value = arr[1];
                
                }      
            });
            break;
        default:;
    } // switch
} // ff_vagas_escola_action
This will make another ajax call to database.
This will fill textfields named "vaga" and "emailescola" with the vacant and e-mail retrieved from database.

NOTE: Replace "http://localhost/value2.php" with the correct url to the new value.php2 file that you will create.

2) Then go to the Joomla root folder and create there file named value2.php with the following content:
<?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';


$judgePick = JRequest::getVar('vagas_escola'); 
$db = JFactory::getDBO();
$db->setQuery('SELECT `quantidade_de_vagas`, `email_escola` FROM `vagas` WHERE escola ='.$db->quote($judgePick)); 
$result = $db->loadRow();
 if(!$result){
 	echo "error";
} else {
	echo json_encode($result);
}
NOTE: `quantidade_de_vagas` and `email_escola` must correspond to the names of the columns in the table vagas in order for this to work.

Let me know whether you've managed to apply this to your form and whether it works as you wanted.

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 #232492

  • Topic Author
  • mlangamer
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 24
  • Thanks: 0
Hello Mihaela
Everything worked. Just as you walked it was done and everything went right. It worked!
I'd like to of course without abusing your goodwill, but rather leverage to learn more about how to use this tool.

Now I need to make two more adjustments to the form.

• First, do not let the same student enroll in two schools. If he is already registered in a school send a message saying that the student is already registered in the network. The Key Fields are: (nome) and (telefone).

• Secondly perform a calculation on the Element (Nascimento), because this field is the date of birth of the student and depending on the date he was born already set the Element (tipo_vaga)

Example:
If the student's date of birth, Element (Nascimento) is greater than one year and six months set the Element (tipo_vaga) as (Educação Infantil – creche IA) and from there will already show vacancies for this series only.
If you can guide me I thank you very much.

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

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

  • Topic Author
  • mlangamer
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 24
  • Thanks: 0
One more detail would like to send an email to the school through the element (emailescola). I already tried to put it in Admin Emails / Email to / {emailescola: value} but it is not working. If you can guide me where as how to proceed.
God bless you!

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

Moderators: ForumSupport
Time to create page: 0.055 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!