Lookup value in db, return associated field URL, redirect user to that URL

  • bulgin23
  • Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
  • Posts: 21
  • Thank you received: 0

bulgin23 replied the topic: Lookup value in db, return associated field URL, redirect user to that URL

Hello. I'm using the form successfully however, when I add the built-in captcha and the captcha is in error, the form redirects to a www/html directory. I'm sure this is not normal procedure.

This happens regardless if "Last page is thank you page" checked or unchecked.

You may recall, this is my code for the form:

$this->execPieceByName('ff_InitLib');
$db = JFactory::getDBO();
$submittedtoken = ff_getSubmit('bfQuickMode8826903');
$db->setQuery("Select url From gexsy_token WHERE token ='$submittedtoken' " );
$urlToRedirect = $db->loadResult();
JFactory::getApplication()->redirect($urlToRedirect);
#235218
  • mihaela
  • Away
  • Administrator
  • Administrator
  • Posts: 2360
  • Karma: 85
  • Thank you received: 316

mihaela replied the topic: Lookup value in db, return associated field URL, redirect user to that URL

Hello,

Have you put that code in the "End Submit pieces" and not in "Begin Submit"?

You wrote "when I add the built-in captcha and the captcha is in error, the form redirects to a www/html directory".

By default when clicking on "submit" with the wrong captcha entered, form should stay on the same page and display this error message:
The captcha is missing or wrong!

Regards,

Mihaela
#235227
  • bulgin23
  • Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
  • Posts: 21
  • Thank you received: 0

bulgin23 replied the topic: Lookup value in db, return associated field URL, redirect user to that URL

Yes, I've verified it's in the end submit pieces.

I'm going to buy the pro version and use recaptcha and see if that works better.
#235262
  • bulgin23
  • Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
  • Posts: 21
  • Thank you received: 0

bulgin23 replied the topic: Lookup value in db, return associated field URL, redirect user to that URL

Note 1 - please disregard my message about unable to remove free plugin, I got that figured out.

Note 2 - purchased pro but same problem. When incorrect value for token is submitted, Breezingforms immediately returns the user NOT to the same form but redirects to a top level directory of /var/www/html.

Remember a couple of things a) the code below which maybe needs a line of code at end for when a match is NOT made on the database lookup and b) the below code is in the End Submit Pieces right now.
#235266
  • bulgin23
  • Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
  • Posts: 21
  • Thank you received: 0

bulgin23 replied the topic: Lookup value in db, return associated field URL, redirect user to that URL

I modified the code you originally supplied from:

$this->execPieceByName('ff_InitLib');
$db = JFactory::getDBO();
$submittedtoken = ff_getSubmit('bfQuickModexxxxxxx');
$db->setQuery("Select url From gexsy_token WHERE token ='$submittedtoken' " );
$urlToRedirect = $db->loadResult();
JFactory::getApplication()->redirect($urlToRedirect);

To:

$this->execPieceByName('ff_InitLib');
$db = JFactory::getDBO();
$submittedtoken = ff_getSubmit('bfQuickModexxxxxxx);
$urlNotFound = (' www.the-redirect-url.com ');
$db->setQuery("Select url From gexsy_token WHERE token ='$submittedtoken' " );
$urlToRedirect = $db->loadResult();
if ($urlToRedirect !== null)
{ JFactory::getApplication()->redirect($urlToRedirect); }
else { JFactory::getApplication()->redirect($urlNotFound); }

And it works. Please advise if the syntax is correct and without any issues. Thank you.
#235267
  • mihaela
  • Away
  • Administrator
  • Administrator
  • Posts: 2360
  • Karma: 85
  • Thank you received: 316

mihaela replied the topic: Lookup value in db, return associated field URL, redirect user to that URL

Hello again,

From what I can see the syntax is correct and it should work properly.

In case no token was entered it will redirect users to ' www.the-redirect-url.com '.

I'm glad that adding this condition resolves the issue.

Regards,

Mihaela
#235271
Moderators: ForumSupporttomeperica
Time to create page: 0.072 seconds

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Summer Sale!

50% discount on all of our extension subscription plans & templates!

Get Your Subscription Here

News and Updates

Get informed about new downloads, updates and more in our News and Updates newsletter.

All Extensions Subscription

Get 1 year access to all of our current and future products and 1 year of professional support -- 99 for just 49! (Summer Sale)

No support per domain or website installation limits! Includes all of our current and future Joomla!® extensions, Joomla!® templates for the duration of your membership. This means, by purchasing an All Extensions Subscription you'll have it all covered!

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Community Reward

Help us to create new extensions and plugins! With only $5 you help us a lot and get unlimited download access to all of our products, professional support and even more. Get your reward now!

Read More Here