In CakePhp3 how to go back to respective page after clicking back button - cakephp

I have detail page which can be access from other two pages.
how to return to page that the user came from????
I have page like this:
page1 →index1→detail1→edit→confirm page
page2 →index2→detail2→edit→confirm page
currently I'm using below code
<div class="btn-clear">Go Back</div>
but the problem is after going to confirm and click back button and user came to edit page.and if the user click back button on edit page where i have written above code error occurs.
error is:
Notice (8): Undefined variable:report[APP/Template/Reports/confirm.ctp, line 12]
Notice (8): Trying to get property of non-object [APP/Template/Reports/confirm.ctp, line 12]

Related

How to retrieve data from different page angular

I have a button in the table in the first page. When I click on the button, I want to save the panel Id and display on the next page. How can I call the data in angular? I'm desperately seeking for help since I'm stuck in there for almost a week now.
These are the images for my problem.
enter image description here
So this one is the first page, where there are buttons in each row.
After clicking Assign, it should show readonly data of ship name and panel name.
enter image description here
Regarding your issue, you should get the panel_id from params in the URL.
E.g.
In the routing of the assigning page, you just set the path:
{
path: 'assigning/:id',
component: <YourComponent>
}
So you can get the panel_id by using ActivatedRoute.
On click event of "Assign" button, you can pass the value to the ts component. In the ts file you can pass it via URL route as a parameter to the next page or store it in localStorage and read from the next page.
<button (click)="passValue(value)">Assign</button>

Result: [OPERATION FAILED]: MyFirstVFPage: The page you have tried to delete is currently being referenced by a page, custom link, button

I am facing the below error in my salesforce.org.
Operation: Deleting Selected Metadata
Timestamp: Wed, 29 Mar 2017 19:47:33
Result: [OPERATION FAILED]: MyFirstVFPage: The page you have tried to delete is currently being referenced by a page, custom link, button, web tab, dashboard, SoftPhone layout or custom sidebar component. Please delete the reference before deleting the page.
I am not sure whats going wrong and where to check it ?
The message says that your Visualforce page is referenced from a button, page layout, etc. You cannot delete a page if it is used anywhere.
To find out what refers to your page, go to Setup/Build/Develop/Visualforce Pages and click on the field label for your page (MyFirstVFPage). At the top of the detail page, click the button "Where is this used?". This will display a list of all places that refer to your page.
You will need to remove the Visualforce page from anything in the list.

Error when clicking Add-button in CRUD

When a form or an add-button returns to a page, it throws an error or shows wrong output on the page, if there is js or other kinds of output on the page. Here is an example:
$tabs->addTab('Skoler')->add('CRUD')->setModel('School');
$crud=$tabs->addTab('Elever')->add('CRUD');
$crud->setModel($student);
if($crud->grid){
$crud->grid->addButton('addStudents')->set('Importer elever')->js('click',$this->js()->univ()
->dialogURL('Importer elever',$this->api->url('importusers&usertype=student'))
->execute());;
$crud->grid->js(true)->addClass('reloadstudent');
$crud->grid->js('.reloadstudent')->reload();
}
When clicking on "Add School" This outputs
$('#barometeradmin_mgr').univ().dialogURL('Importer elever','/redskab/barometer/admin/?page=importusers\x26usertype=student\x26barometeradmin_mgr_tabs_view_htmlelement_crud_virtualpage=add')
in the dialogurl created by the button.
Is there a way to check if the page is loaded for the second time (that is, by the button).
Thanks!
Jeppe
I think all you need to do is leave out the '->execute()'?

Grails: save to Database without page reloading

How can i save the textfields and checkboxes to the DB without reloading the page?
Just to click on the button and then its in the DB. Nothing more. I don't get it. This means when I have a textfield where I type in a content -> then click the button, the content from the textfield should be in the DB and should do nothing more (not reloading the page, or go to top for example).
I don't get it.
EDIT:
When I have a a <div> tag with the id="testid" in the standard create.gsp:
def create() {
def mytestInstance = new Mytest(params)
}
and the <g:remoteLink> which should save this part looks like:
<g:remoteLink class="button" name="myForm" update="testid"
url="[controller:'mytest', action: 'create']" value="....." />
That does not work because the page is refreshing or something like this and the things are not stored in the DB, plus they are not in the textfields any more.
Use <g:formRemote> or <g:submitToRemote> to do the form submission with an Ajax call.
You should be able to use the formRemote tag to send the data to a controller via Ajax
Edit
As it says on that page;
This tag also requires the use of either the <g:javascript/>(link) or <g:setProvider/>(link) tags. See the AJAX section of the user guide to find out more.
Have you done that?

Jquery mobile ui-btn-active in navbar

I've been trying to get this to work for 4 days now, with no luck.
I have a very simple jquery mobile app.
The app has a header, content and footer.
The footer is being generated dynamically on the 'pagecreate' event because it is always the same and I don't want to have its HTML in every page.
So I do something like this:
$(document).delegate('[data-role="page"]', 'pagecreate', function (e) {
DrawHeader($(this));
DrawFooter($(this));
SetFooterEvents($(this));
SetActiveFooter($(this));
});
DrawHeader() and DrawFooter() simply prepent the header div to the page and append the footer div.
SetFooterEvents() sets the onclick events of the footer navbar buttons and SetActiveFooter() is SUPPOSED to set the ui-btn-active to the current active footer link.
To do this, I've added the data-active-footer attribute to the page div and the data-name attribute to the navbar elements. I'm searching for the current element according to the data-active-footer in the page and apply the ui-btn-active class.
function SetActiveFooter(page) {
page.children('div[data-role="footer"]')
.find('a[data-name="' + page
.attr("data-active-footer") + '"]').addClass("ui-btn-active");}
So far so good.
Now, say I've changed to a page and the navbar is lit (it has successfully recieved the ui-btn-active class), and I'm clicking on the previous page, the lit item in the navbar doesnt change back!
If i click on the the page again (ie: changed to second page [corrent lit], changed back to first page [second page is still lit], then clicked on first page again) it does light the navbar button.
What I found out was that jqm also changed the navbar of the previous page when I'm changing the navbar of the current page in the 'pagecreate' event.
I've tried to overwrite this behaviour using the 'pageshow' event, that is, trying to apply the ui-btn-active class to the current element in the navbar but the problem is that $(this) and e.currentTarget objects in the 'pageshow' event DO NOT CONTAIN THE FOOTER ELEMENT!!!
$(".ui-page").live('pageshow', function (e) {
alert($(this).children('div').length); // returns 2!
alert($(this).children('div[data-role="footer"]').length); //returns 0
alert($(e.currentTarget).children('div').length); // returns 2!
alert($(e.currentTarget).children('div[data-role="footer"]').length); //returns 0});
Any ideas?!
Thanks.
Before delving into more detail, please try adding .ui-state-persist together with .ui-btn-active
This makes sure active buttons stay active when you changePage and the footer is the same. Also make sure, all your footers have the same data-id attribute.
On a sidenote: check the latest blog post about upcoming features for jqm 1.1 - it will include a fetch link utility, which allows to ajax-update portions of a page. So you could use this functionality to grab and insert a footer on every page. I'm trying the same right now with a login form, which I need on every page.
Have you tried "ui-state-persist"?
<div data-role="navbar" data-iconpos="top">
<ul>
<li>Home</li>
<li>Favorite</li>
</ul>
</div>
I still dont know why but jqm moves the footer from page to page, eventhough I assign a new footer to each page.
Maybe because I set the same ID to all of them.
Anyhow, I used this workaround to solve the problem:
On the 'pagebeforeshow' event, I set the button I want active to all the footers in the documents. I've set a special data-name attribute to each navbar button, I give it the 'ui-btn-active' class after removing it from the rest of the items.
var $footers = $(document).find('div[data-role="footer"]');
$footers.find('a').removeClass("ui-btn-active");
$footers.find('a[data-name="' + page
.attr("data-active-footer") + '"]').addClass("ui-btn-active");

Resources