mysql database query in element (select from list)

  • mlangamer
  • Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
  • Posts: 24
  • Thank you received: 0

mlangamer replied the topic: mysql database query in element (select from list) - item 2

Item 3 solved!
Wonderful!
Mihaela, you're awesome!
It worked!

Now I have a problem with the calculation. I already did and it worked. the person enters the date he performs the calculation and brings the result to the field in the first select. the point is that ajax does not happen in the second select.
What can I do ?
#232555
  • Posts: 2348
  • Karma: 85
  • Thank you received: 315

mihaela replied the topic: mysql database query in element (select from list) - item 2

Hello again,

Thank you for the kind words.

Can you please send me the code that you have written for calculation and setting the first select list's value?

The problem is that when you change select list's value using the
ff_getElementByName('tipo_vaga').value=...
function the Actionscript doesn't recognize that the change was made.

Therefore you need to add a line of code like the following to the script that you have written in order to run the Actionscript in "tipo_vaga" select list:
ff_tipo_vaga_action();

That should run the actionscript and ajax call.

Regards,

Mihaela
#232564
  • mlangamer
  • Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
  • Posts: 24
  • Thank you received: 0

mlangamer replied the topic: mysql database query in element (select from list) - item 2

ihaela

I put this code in
Form Piece / Before Form

echo '<script src="/includes/js/maskedinput/src/jquery.maskedinput.js"
type="text/javascript"></script>';
echo '<script>
jQuery(function($){
$("#ff_elem1930").mask("99/99/9999");
$("#ff_elem162").mask("(999) 999999999");
$("#ff_elem192").mask("99/99/9999");
});

</script>';
echo '<script src="/includes/js/moment/moment.js"
type="text/javascript"></script>';
echo "<script>function calculaIdade() {
var dtNascimento =JQuery('#ff_elem1930').val();
var dtFinal = '31/03/2019';
//alert(dtNascimento);
//formato do brasil 'pt-br'
moment.locale('pt-br');
//setando data1
var data1 = moment(dtNascimento, 'DD/MM/YYYY');
//setando data2
var data2 = moment(dtFinal, 'DD/MM/YYYY');
//tirando a diferenca da data2 - data1 em dias, mes ou ano
var idadeMeses = data2.diff(data1, 'month'); //ano = years, mes = month, dia = days
var idadeAnos = data2.diff(data1, 'years'); //ano = years, mes = month, dia = days


if(idadeMeses == 3){
JQuery('#ff_elem552').val('Educação Infantil – creche IA');
} else if(idadeAnos == 3){
JQuery('#ff_elem552').val('Educação Infantil – creche II');
} else if(idadeAnos == 4){
JQuery('tipo_vaga').value('Educação Infantil I ');
ff_tipo_vaga_action();
} else if(idadeAnos >= 5 && idadeAnos <= 7){

}
}
</script>";



The first part is of the masks of the fields

And the second is from the calculation

Includes call ff_type_vaga_action ();
But it did not work.

The calculation is working.

I am able to call the value on the first select but the second select is not working.
#232567
  • Posts: 2348
  • Karma: 85
  • Thank you received: 315

mihaela replied the topic: mysql database query in element (select from list) - item 2

Hello again,

I see that you have added the ff_tipo_vaga_action() function call only in case "idadeAnos == 4". Nevertheless I doubt that the ff_tipo_vaga_action() function can be called form there but you can try once more if you unintentionally added it just to case "idadeAnos == 4" .

The way to solve this is to write the code for calculation age in Actionscript of the textfield that is meant for a date input instead of writing the code in Before Form pieces.

Then at the end of Actionscript function you can add
ff_type_vaga_action ();
Then filling in second select list will work properly.

Let me know whether you've managed to write the code in Actionscript.

Regards,

Mihaela
#232598
Moderators: ForumSupporttomeperica
Time to create page: 0.077 seconds

Summer Sale!

50% discount on all of our extension subscription plans & templates!

Get Your Subscription Here

News and Updates

Get informed about new downloads, updates and more in our News and Updates newsletter.

All Extensions Subscription

Get 1 year access to all of our current and future products and 1 year of professional support -- 99 for just 49! (Summer Sale)

No support per domain or website installation limits! Includes all of our current and future Joomla!® extensions, Joomla!® templates for the duration of your membership. This means, by purchasing an All Extensions Subscription you'll have it all covered!

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!

Community Reward

Help us to create new extensions and plugins! With only $5 you help us a lot and get unlimited download access to all of our products, professional support and even more. Get your reward now!

Read More Here