• BassDogg

    (@bassdogg)


    Hey there, so i’m not sure if this is where i need to be posting – sorry if this is the wrong location/etiquette. Also i am a pretty big newbie!

    So, I have a page where my clients put in their payment details into a form. When the form is submitted, the details are then submitted into the payment gateway. My issue is this: I need to automatically add a 1.5% surcharge to what ever figure is added by the user, to cover the credit card costs before it goes to the payment gateway. I have worked out how to do this using javascript, but cant get this to work on the wordpress site.

    The form code and the js is below. I have used the plugin ‘code embed’ but unfortunately it is still not working for me. Any help/suggestions would be much appreciated. Alternatively, if there is a much better way of going about it I am all ears.

    <form action="" method="post">
        <table>
            <tbody>
                <tr>
                    <td>Your Name:</td>
                    <td>
                        <input maxlength="64" name="TxnData1" id="name" type="text" value="" />
                    </td>
                </tr>
                <tr>
                    <td>Your Email:</td>
                    <td>
                        <input name="EmailAddress" id="email" type="text" value="" />
                    </td>
                </tr>
                <tr>
                    <td>Quote/Invoice Reference No:</td>
                    <td>
                        <input name="MerchantReference" id="quote" type="text" value="" />
                    </td>
                </tr>
                <tr>
                    <td>Amount:</td>
                    <td>
                        <input name="Amount" id="Amount" type="text" value="00.00" />
                    </td>
                </tr>
                <td>Amount with surcharge:</td>
                <td><span id="AmountInput"></span>
    
                </td>
                </tr>
                <!-- Indicate what currency the transaction will be in -->
                <tr>
                    <td>Currency:</td>
                    <td>Australian Dollar(AUD)</td>
                </tr>
                <tr>
                    <td></td>
                    <td>
                        <input name="mypaymentform" type="submit" value="Next" />
                    </td>
                </tr>
            </tbody>
        </table>
    </form>

    js

    <script type="text/javascript"> $(document).ready(function () {
        $('#Amount').keyup(function () {
            $('#AmountInput').text($('#Amount').val() * 1.15);
        });
    });</script>

    thank you in advance, and et me know if you need any more info!

    Thanks

Viewing 12 replies - 1 through 12 (of 12 total)
Viewing 12 replies - 1 through 12 (of 12 total)

The topic ‘java script’ is closed to new replies.