JSF/Primefaces/PrettyFaces - do action everytime button or link is being clicked - jsf-2

What shall I implement to do certain action whenever button/link is clicked?
I want to save every URL of the page that button is clicked to make a history of pages.

Well,
I come up with following idea: implement custom Navigator with forward & redirect methods which will put pretty faces IDs to history stack. Call navigator's method when using link, call navigator's method in regular beans, so every method's signature will be void.

Related

How to disable back operation of Flutter's Navigator class

After a login page, a page gets replaced by an overview page like so:
Navigator.popAndPushNamed( context, MyApp.ROUTE_TESTER_TASK_OVERVIEW );
This removes the current page from the Navigator's stack and pushes the new page on it. Fine.
Q: But how to I disable, that a user performs a back navigation? The user shouldn't bee able to leave the Task Overview page.
Should I keep the stack holding one and only one page all the time.
Or does Navigator has another option to disable a back navigation?
Q: Additionally, I want to disable the swipe right gesture, so than it doesn't show the previous page [as I the user clicked Android's back button].
One possible (probably not the best) solution is to wrap the second page within a WillPopScope widget. In the onWillPop parameter you can just return Future.value(false) to intercept all pop actions.

Event for all Controls (Textbox)

I have many textboxes in my form and all of it have keypress.
Is there another way to shorten by code instead writing the code for each texboxes?
Thank You for your Answer.
You can create a subclass (let's call it subTB) of TextBox in which you define the action for keyPressed. Then make your TextBox be instances of subTB instead of instances of TextBox. You have a link to a tutorial in this comment.
Or you can create a function that contains the action to perform when a key is pressed. And the in all your textBox, on the key pressed event, call this function. This second choice will make you also write multiple time the same but this same code will just be a call to the function.

How to have one button do both "enable" and "disable" in ASP.net MVC

I am new to ASP.Net MVC, and still trying to wrap my head around the controller and passing data to the view and back.
Here is my question. I have a model in my view with a property that is "isEnabled", which can be true or false.
I have an edit button, and an enable/disable button. Edit just takes me to a new view with a form.
I want the enable/disable button to change the property of the model to enabled or disabled.
Right now I have two separate buttons. When I click on them, it fires the appropriate action from the controller (EnableModel, DisableModel), and just reloads the current view.
How can I make it so, if the model is disabled the button shows and fires the enable action, and when it is enabled, the button shows and fires the disable action.
So here are the options I thought of.
1. Two buttons, I hide them as needed. I can use an if statement to check if the model is showing or not in razor.
2. Use javascript two to the above
3. Use javascript to physically change the button
What would be the best method?
Alright so looking back can't believe I ever even asked this haha.
I went the javascript route. I had a single button, and a simple onClick javascript class that would handle the toggling.

Not able to see the page the event is firing with in SiteCatalyst

I'm firing an event on a button click, and I have checked in omnibug/fiddler that it's firing and I'm seeing it in the report. However, I'm not able to see a breakdown of the pages it's happening on. Is this because it's firing on a click event and not a pageload? If so, what's the best way to set up so that I get a count of the number of times a button is clicked and have the ability to break this down by page (i.e. if it's a global or semi-global element)
Assuming you are using s.tl call with the button click - that means it wont increment page view and wont track pagename (even if you pass it with call it will get stripped)
Either have s.t call and have pagename with it (not an ideal way) else approach suggested by Crayon would help.

grails modalbox redirect back to parent window

I am new to grails, and I have been trying to get the following functionality to work.
I am using grails modal box, and I have a save button. When I click on save, how can I close the modal box, and pass a variable back to the parent window?
I think I'm doing what you want in my Customer Change actions in a couple screens at http://ibidem.cloudfoundary.com. Login as ibidem/ibidem and do a Customer Change on a Lookup Table.
Then if this is what you want, see
https://trac.maflt.org/web/ibidem/browser/trunk/src/ibidem/grails-app/views/lookupTable/show.gsp
and the corresponding controller:
https://trac.maflt.org/web/ibidem/browser/trunk/src/ibidem/grails-app/controllers/org/maflt/ibidem/LookupTableController.groovy

Resources