Form validation with redirect |
(10-28-2015, 02:15 AM)msheath Wrote: Many thanks for that I can see how it would work when the form is sent. However what happens if you access the home function from, say, a nav button? The validation run happens even though no form data has been sent, it registers 'false', the view is loaded and scrolls down to the form, even though I don't want it to in that case? No it does not scroll down, as accessing /home is not the same as /home#anchor. You only add the #anchor to your post url which you use in your form. PHP Code: $data['post_url'] = base_url('/home#anchor'); Pass the post_url variable as the first argument on form_open PHP Code: // in your view You only add the #anchor to your post URL. Any nav buttons or menu links will link to the page without the #anchor |
Welcome Guest, Not a member yet? Register Sign In |