Jump to content

[SOLVED] Possible with javascript?


Shamrox

Recommended Posts

I have a dropdown list on a form that lists different types of credit cards. I also have a form field that is called charge card fee and I would like this to be populated with a $ amount based on what card was selected from the dropdown. Each card has a different fee that is a % of the sale price. So there is a third field of Price that is involved.

Is there a way to have the fee field calculated and populated using javascript?

 

Any help is appreciated. Thanks.

Link to comment
Share on other sites

function checkCC(){

var type  = document.getElementById(this);

var perct = 0;

switch(type){

case 'visa':

perct = .25;

break;

case 'mastercard':

perct = . 28;

break;

}

document.getElementById('id of field that holds the percent value, this could be a hidden field, just give it an id').value = perct;

}

 

<select onchange = "checkCC(this)"></select>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.