function isValidCard(num, isVisa, isMaster, name, mon, year) {


    if ((document.getElementById('radioVisa').checked ==  true) ||
           (document.getElementById('radioMaster').checked == true) && 
           (document.getElementById('isValidCardNumberArg').value == true) &&
           (document.getElementById('isValidCardHolderArg').value == true) &&
           (document.getElementById('isValidExpireMonArg').value == true) &&
           (document.getElementById('isValidExpireYearArg').value == true)) {

                return true;
            } else {
                return false;
            }

I need to verify all the functons in this last function. If all the script sections return true, then isValidCard returns true. The above script is working for the Visa but not if the mastercard is selected..If mastercard returns true, then I am still getting a false in this function. I am not even sure if this is the right way to do this, it just made sence to me..... Any advise appreciated . Thanks Jane

Member Avatar for LastMitch

I am not even sure if this is the right way to do this, it just made sence to me..... Any advise appreciated . Thanks Jane

First of all there should be no true or false regarding about credit card. It's the customer info and credit card number and date determine is valid rather the data (name of the card). I'm not sure why you need something like that.

Is this a checkout sheet? There's more code involve than just what you post.

Each radio button / check box are link to other code (checkout sheet with customer info and credit card number and date).

This is how to vertfy to see if this credit card and the data is valid. If the credit card is submit and then it goes through it's valid meaning true if it doesn't go through it is invalid meaning it's false.

So I hope you get an idea how this works.

@LastMitch yes each of the getElementById has its own code vaidation, and now i am required to put all of it into the one function.... It is for uni, s and I need to do it the way it is asked of me.......

@LastMitch Thank you for the links, but I am still not getting it..... please don't think I want you to do my work for me because I am not. I just want to understand it myself... I have tried to use the links as a guide but I am still obviously missing something.

Member Avatar for LastMitch

please don't think I want you to do my work for me because I am not. I just want to understand it myself... I have tried to use the links as a guide but I am still obviously missing something.

OK, can you explain what is interfering with your code? Is it the checkout sheet?

If you are not sure how to link it, remember to link it:

$('#cc_number').validateCreditCard(function(result)

The #cc_number should be part or should be the same div and should be the same name in the database or you used what you have in the database and change #cc_number match to your database.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.