Sep 24th, 2014, 7:53 PM
Hey damon18,
How familiar are you with jQuery/javascript? One way would be to use the field <input type="hidden" name="form_tools_form_url" value="" /> when submitting your form. In the value just pass a url like so http://www.url.com/#contact and craft some simple jQuery to check the url on page load for the hash and if it exists, scroll to the element with that id. Easy peasy.
Let me know if this does the trick.
How familiar are you with jQuery/javascript? One way would be to use the field <input type="hidden" name="form_tools_form_url" value="" /> when submitting your form. In the value just pass a url like so http://www.url.com/#contact and craft some simple jQuery to check the url on page load for the hash and if it exists, scroll to the element with that id. Easy peasy.
Let me know if this does the trick.
(Aug 7th, 2014, 3:30 PM)damon18 Wrote: OK, looks like the the first problem of not retaining the values after failed captcha was my mistake in the php code for each field.
I still need help with the second problem, how to make the page redirect back down to the section id="contact" on the failed captcha.
Corrected form is
Code:<form role="form" action="<?php echo $_SERVER["PHP_SELF"]?>" method="POST">
<div class="row">
<div class="form-group col-xs-12 floating-label-form-group">
<label for="name">Name</label>
<input class="form-control" type="text" name="name" id"name" placeholder="Name" value="<?=htmlspecialchars(@$fields["name"])?>" />
</div>
</div>
<div class="row">
<div class="form-group col-xs-12 floating-label-form-group">
<label for="email">Email Address</label>
<input class="form-control" type="email" name="email" id="email" placeholder="Email Address" value="<?=htmlspecialchars(@$fields["email"])?>" />
</div>
</div>
<div class="row">
<div class="form-group col-xs-12 floating-label-form-group">
<label for="mymessage">Message</label>
<textarea class="form-control" name="mymessage" id="mymessage" rows="5" placeholder="Message"><?=@$fields["mymessage"]?></textarea>
</div>
</div>
<br>
<div class="row">
<div class="form-group col-xs-12">
<div><?php if (!empty($g_api_recaptcha_error)) { ?>
<p class="alert alert-danger"><span class="glyphicon glyphicon-warning-sign"></span> Your submission did not match the captcha, please try again.</p>
<?php $g_api_recaptcha_error = ""; ?>
<?php } ?>
</div>
<div><?php ft_api_display_captcha(); ?></div><div><button name="submitmemphisguru" type="submit" class="btn btn-lg btn-success">Send</button></div>
</div>
</div>
</form>