Prevent form data from appearing in headers "Form Data" section by removing attribute?

154 Views Asked by At

I'm using accept.js which creates the object desired, but I'd like to also add another layer of protection by preventing the form data itself for the credit card posting. Specifically Id like to prevent it from appearing in the form data section as the thank you page loads. We don't want to send that information at all.

I've tried removing the name attribute, but that doesn't seem to work. It's possible I did this incorrectly.

This image shows form data headers on the success page which we post to. Again, we'd like to prevent that data from appearing here. Specifically the credit card data. https://i.stack.imgur.com/awyz2.jpg

I'm told this is possible and a good idea, but can't seem to figure out how to implement it. What we receive is the credit card number even though we've removed the name attribute on form submit.

// Create a connection between form and Authorize
    Accept.dispatchData(secureData, function(res){
        if(res.messages.resultCode === "Error"){
            for(let i = 0; i < res.messages.message.length; i++){
                console.log(res.messages.message[i].code + ": " + res.messages.message[i].text);
                return false;
            }
        }else{
            let opaqueData = res.opaqueData;
            console.log("this prior to resetting values cardNumberE1.Value = '';   ============  " + cardNumberEl.value);
            // clear out values before submitting
            cardCodeEl.value = "";
            cardNumberEl.value = "";
            cardholderNameEl.value = "";
            monthEl.value = "";
            yearEl.value = "";
            zipEl.value = "";

            document.getElementById("input_28_52").value = opaqueData.dataDescriptor;
            document.getElementById("input_28_53").value = opaqueData.dataValue;
            console.log("this after resetting values cardNumberE1.Value = '';   ============  " + cardNumberEl.value);
            console.log("this is the value of the hidden field opaqueData.dataDescriptor;   ============  " + document.getElementById("input_28_52").value);
            console.log("this is the value of the hidden field opaqueData.dataValue;   ============  " + document.getElementById("input_28_53").value);
            //cardholderNameEl = document.getElementById("input_28_26_5");
            // We no longer need to send to our plugin, rely on GF plugin to send opaqueData
            jQuery("#input_28_26_1").removeAttr('name');
            console.log("end");
        }
    });
0

There are 0 best solutions below