I’m a beginner to CakePHP and I’m very excited to to work with it too, I started reading the documentation a few days ago!
And decided to work on an application, so in it, I have a list of records which I edit repeatedly.
Problem : Whenever I work on a particular record and save my work, the web page returns me to the top of the page. Expected Result : After saving my work, I need to return at the exact same spot where I made the edited previously.
Is there any Cake-ish way to achieve this? I have no clue how to get this done, I searched on google but no luck yet.
I would really appreciate if anyone can help me with this, thanks a lot!
You will want to have HTML tags with id attributes at the various return points in your page. And the action attribute for the form you are submitting will need to include the id anchor you want to return to after submitting.
This is a pretty unusual page behavior, but technically possible.
From your description it sounds like you have a series of forms:
<form action="url#anchor1">
// form inputs here
// submit button
</form>
<form action="url#anchor2" id="anchor1">
// form inputs here
// submit button
</form>
<form action="url#anchor3" id="anchor2">
// form inputs here
// submit button
</form>
Now when each form gets submitted, the url (and so the Request object in your application) will include the name of the point on the page you want to go to.