Geocoder Error Checking

By ross - January 29, 2016

Hi Jerry

Could you give me more detail about what you mean with 2 submission clicks are required to get to the results page?  

That might end up being the problem if the ZIP code is entered on the first submission but not checked until the second submission.

Let me know.

Thanks!

-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

Hi Ross,

Thanks for looking at this.

Sounds like that might be the issue but I have no idea how to get around the problem.

You can try it yourself (one demo worth a thousand words, etc.)

http://dbtproviders.com/directory_searchB.php

Basically, the first click on the submit button with a valid zip code just  re-loads the search page, a second click brings up the results page.

Both the search form and the results page are attached.

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

By ross - February 1, 2016

Hi Jerry

I've looked through your code and I think there's a problem with the { } with your if blocks.

Take a look at this block of code:

if (@$_REQUEST['save']) {

     @$count = '';
     @$count = mb_strlen($_REQUEST['fromAddress']  );

     if     (!@$_REQUEST['fromAddress'])                    { $errorsAndAlerts .= "No zip/postal code entered.<br/>\n"; }
     elseif (@$count < 5 )                                  { $errorsAndAlerts .= "Your zip/postal code must be at least 5 digits long.<br/>It is currently under 5 digits.<br/>\n"; }

elseif ((!@$myLat || !@$myLng))                             { $errorsAndAlerts .= "Please enter a valid zip/postal code.<br/>\n"; @$_REQUEST['save'] = ''; }

if (!@$errorsAndAlerts && @$count > 4 && @$count <= 12)     { $action .= "http://dbtproviders.com/directory_resultsB.php"; }

}

I formatted the code a bit so it's easier to see what I'm talking about.

What I think you need to do is take that last } and move it up a bit like this:

if (@$_REQUEST['save']) {

     @$count = '';
     @$count = mb_strlen($_REQUEST['fromAddress']  );

     if     (!@$_REQUEST['fromAddress'])                    { $errorsAndAlerts .= "No zip/postal code entered.<br/>\n"; }
     elseif (@$count < 5 )                                  { $errorsAndAlerts .= "Your zip/postal code must be at least 5 digits long.<br/>It is currently under 5 digits.<br/>\n"; }
}

elseif ((!@$myLat || !@$myLng))                             { $errorsAndAlerts .= "Please enter a valid zip/postal code.<br/>\n"; @$_REQUEST['save'] = ''; }

if (!@$errorsAndAlerts && @$count > 4 && @$count <= 12)     { $action .= "http://dbtproviders.com/directory_resultsB.php"; }


Give that a shot and let me know how it effects your search.

Thanks!

-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

By gkornbluth - February 1, 2016 - edited: February 1, 2016

Hi Ross,

Really glad that you could look at this.

Unfortunately that didn't change anything. It still takes 2 submits to get to the results page.

You can see the attempt at http://dbtproviders.com/directory_searchC.php

I've attached the revised files as before.

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

By ross - February 2, 2016

Hi Jerry

I need to clarify what issue we are looking at here.

Is the problem that the error checking doesn't work or that it takes two submits to get to your results?

Let me know.

Thanks!

-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

Hi Ross,

It's that it takes 2 submits to get the result

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

By ross - February 4, 2016

Hi Jerry

Thanks for clarifying.  I recommend removing the error checking and getting your code as close to the generator code as possible. That should get the page submitting properly.  Then add the error checking back in bit by bit.

What this should do is get your form submitting with just one click. And as you add the error checking back in bit by bit, you'll eventually get to the part that's causing the double submit issue.

Does that make sense? 

Let me know how you make out.

Thanks!

-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

Thanks Ross,

Good suggestion

I'll give it a try and let you know

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php