1

I am using the address verification API from smartystreets in an aspx web page which is using a Wizard.

My code is in VB .NET 2010.

When the user clicks the NExt button, the address gets automatically verified, but the user has to click again on the NExt button to go to the next page, even though the address is good.

How do I fix this issue?

Here is my javascript:

<script language="javascript" type="text/javascript">
        var liveaddress = $.LiveAddress({        key: '5562733960493880117', debug: true, autoVerify: false});
        liveaddress.on("AddressAccepted", function (event, data, previousHandler) {
            if (data.response.isMissingSecondary()) {
                data.address.abort(event);
                alert("Don't forget your apartment number!");
            }
            else
                previousHandler(event, data);
        });

 </script>
Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
Francine
  • 11
  • 1
  • 1
    It looks like you have `autoVerify` set to `false`. What do you mean by "the address gets automatically verified"? As in, the user submits the form, the address verifies, then they have to press the Submit button again to submit the form? What happens if you remove all other Javascript from the page? – Matt Jun 05 '13 at 15:24

1 Answers1

0

You can use submitSelector property when initializing to fire Address validation on click of particular button.

submitSelector: Default: "[type=submit], [type=image], [type=button]:last" — The selector which is used to identify submit buttons inside each form. If not already done, addresses should be verified (or at least accepted) when the form submits. If they aren't, then make sure this selector is finding your submit buttons correctly. You might even set this to be the ID of the submit button: "#mySubmitButton"

I have noticed that regardless of above code, Address validate fire's for any button with input type="submit" and in Asp.net , asp.net button is rendered as type="submit" by default, you can make it type="button" by using UseSubmitBehavior="false"