TOPIC:

text field use if else 2 years 8 months ago #214800

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

we're working on your form. It has some JavaScript errors that we're fixing. You can expect your form back on Thursday.

Regards,

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

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

text field use if else 2 years 8 months ago #214801

  • Topic Author
  • aminweb
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 91
  • Thanks: 0
Thank you so much
So I'm waiting for your answer

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

text field use if else 2 years 8 months ago #214865

  • Topic Author
  • aminweb
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 91
  • Thanks: 0
Hi to beautiful Thursday ;)
Mr. Mihaela, have you checked?
I'm waiting for your server solution.

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

text field use if else 2 years 8 months ago #214933

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

Sorry for waiting.

We edited your form to do what you wanted and it is ready for use now. I'm sending it as an attachment. Also, we added missing fields to your form.

You can see the code bellow needed for your calculations if you go to Advanced > More options > Scripts. Initialization Script Type should be set to Custom and the code is there.
function ff_eghamat_init()
{
    setInterval(showage,500);
    setInterval(calc, 500);

} // ff_calc_age_init

function calc() {
    var total = 0;
    var paygov;
    
   for(var i = 1; i < 4; i++) {
        var paygov = jQuery('[name="ff_nm_paygov'+i+'[]"]:checked').val();
    
        if(  ff_getElementByName('calculated_age'+i).value < 18 && jQuery('[name="ff_nm_eghamattime'+i+'[]"]:checked').val() == 'oneyear') {
            ff_getElementByName('bimetottal'+i).value =  Number(paygov) + 40;
            }
        else if( ff_getElementByName('calculated_age'+i).value < 18 && jQuery('[name="ff_nm_eghamattime'+i+'[]"]:checked').val() == 'twoyear') {
            ff_getElementByName('bimetottal'+i).value = Number(paygov) + 70;
            }
        else if(  ff_getElementByName('calculated_age'+i).value > 18 && jQuery('[name="ff_nm_eghamattime'+i+'[]"]:checked').val() == 'oneyear') {
            ff_getElementByName('bimetottal'+i).value = Number(paygov) + 80;
            }
        else if(  ff_getElementByName('calculated_age'+i).value > 18 && jQuery('[name="ff_nm_eghamattime'+i+'[]"]:checked').val() == 'twoyear') {
            ff_getElementByName('bimetottal'+i).value = Number(paygov) + 140;
        }            
    }
     //Calc for Total
     total = Number(ff_getElementByName('bimetottal1').value) + Number(ff_getElementByName('bimetottal2').value) + Number(ff_getElementByName('bimetottal3').value) 
     + Number(ff_getElementByName('bimetottal4').value);
     ff_getElementByName('pricetottal').value = Number(total);

}

function showage(){
    var one_year=1000*60*60*24*365;
    var date1 = new Date();
    for (var n = 1; n < 4; n++) {
        var  dob= ff_getElementByName('birthday'+ n).value;

        var tmp=dob.split("/");
        var date2=new Date(tmp[2],tmp[1]-1,tmp[0]);

        var pattern = /[0-3][0-9]\/(0|1)[0-9]\/(19|20)[0-9]{2}/; //Regex to validate date format (dd/mm/yyyy)
        if (pattern.test(dob)) {
            var y1 = date1.getTime(); //getting current year
            var y2 = date2.getTime(); //getting dob year
            var diff=Math.floor((y1-y2)/one_year);
            
            ff_getElementByName('calculated_age'+ n).value=diff;
        }
    }
} // showage END

If you have more questions, feel free to ask.

Regards,

Mihaela
Attachments:
The following user(s) said Thank You: aminweb

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

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