Cancel button Icefaces with immediate=true - icefaces

I have a form with save and cancel buttons, cancel button has immediate=true but it doesn't clear the submitted values in the form. I google it and I found this page http://jira.icefaces.org/browse/ICE-1343;jsessionid=2996E8791051E9D6775348E6CE1BC118, it says that the solution is to put an action listener in the cancel button that calls a function that clear the submitted values, it works partially because when I have other tags like panels it doesn't clear them.
Any solution? thanks

Check out the solution presented here : http://www.icefaces.org/JForum/posts/list/13807.page
I personally haven't found a good solution beside the two most obvious ones : manually traverse the UI components and nullify them

We used partialSubmit="true" without setting the immediate attribute to true. This works in Icefaces 1.8.2, but there is one drawback. If the validation failed once, it will be executed always.
With Icefaces 2.x, the suggested way is to use singleSubmit="true", but I haven't tried it.

I use immediate="true" and partialSubmit="true" on cancel and something like this for actionListener
public void cancelPopup(ActionEvent event) {
FacesContext.getCurrentInstance().renderResponse();
}

Related

Long press an element to show the black options bubble(copy,forward..) like wtsapp?

Can someone point me to the right direction of how to show options(copy, forward...) when I long press an element (a message in this case) like wtsapp/FB messenger?
I don't even know what keywords should I be searching...(tried modal, popover, action sheet)
Thanks.
Update:
I understand that I should use the on-hold gesture...I am specifically looking for the black option bubble to be shown. I don't know what it is called(not modal/pop up/ action sheet/popover/alert). Thanks.
you can use on-hold="myFunction()", check the link below
http://ionicframework.com/docs/api/directive/onHold/
and then use the $ionicActionSheet Service to do your logic, check the link below
http://ionicframework.com/docs/api/service/$ionicActionSheet/
on-hold event is your friend : http://ionicframework.com/docs/api/directive/onHold/
I think following Codepen example would help in accomplishing what you want to do:
Actionsheet : http://codepen.io/ionic/pen/jLylA
Also, have a look this thread on Ionic Forum before you start implementing, just to avoid any similar issue, plus, this thread got some CodePen examples, that your might find useful :
https://forum.ionicframework.com/t/displaying-actionsheet-on-a-long-press-aka-hold-event-problem/5663
You can implement long press with either on-hold and if you want to implement long press for buttons, try this directive from this link and a note on directive can be found here . You may need to use a custom action sheet ($ionicActionSheet) to implement the UIMenuController (iOS component) like feature.
.selectable{
-webkit-user-select: auto;
}
for selection and ion-content to overflow-scroll="true"

How can I use mnemonics on JavaFX 8 Alerts

I would like to be able to add accelerator keys for the buttons that are provided as a part of the Alert Dialog Controls included with JavaFX.
I am unsure if this is possible using the standard alert types ERROR, INFORMATION, CONFIRMATION, WARNING?
I created my own login window - which doesn't use an Alert structure and it works as follows:
When the stage opens up.
Then when the user hits the "ALT" key:
I would like the ability to "Hot Key" the buttons on the Alerts in the system. However, I am unsure if I can use the standard alerts, or if I need to create my own, and if so, how should I do that.
I really would like to use the Dialogs natively, if at all possible.
Thanks.
As far as I understood your question, I think it isn't possible without some extra code.
Looking at the code of OpenJFX the labels of the buttons are localized and fixed.
You might just want to create some buttons on your own by using the apropiate constructor which takes some buttons where you can override the existing ones.
EDIT: after rethinking everything, I tried to recreate your problem. You can see that project on GitHub..
This is the special code:
public void showCustomizedAlertWindow() {
Alert a = new Alert(AlertType.CONFIRMATION, "some content text", ButtonType.OK, ButtonType.CANCEL, ButtonType.FINISH);
((Button) a.getDialogPane().lookupButton(ButtonType.FINISH)).setText("_finished");
a.show();
}
But be aware, you are removing localization-support of that buttons.

How do I stop Zend_Form::isValid from removing the values of submit buttons?

I have a Zend_Form object that generates a form in my view.
It does POST processing and submits data to my database.
Sometimes, I notice that my submit button, which simply says "Update Your Changes" is stripped of its value, so its just a button with no text value. I'm surprised Zend_Form is not coded to ignore clearing values from submit buttons.
Is there a way to stop this from happening?
You can try setting the value forcefully in the decorator:
<?php echo $this->element->update_btn->setLabel('Update Your Changes');?>
In addition to s-rupali's answer, you might also try isValidPartial(). This method, regardless of how you implement it (I'm a c# kinda guy) will not validate disabled elements You can then temporarily set your button to disabled, whilst the submission occurs. Afterwards, you can create another method to re-enable it.
http://framework.zend.com/manual/en/zend.form.quickstart.html#zend.form.quickstart.validate

TinyMCE inside Durandal widget - callback after routing transition?

I'm trying to use TinyMCE in a widget but it fails. I think the problem is that view is still hidden when "viewAttached" is fired. It seems that TinyMCE has a bug/feature (read last paragraph) and can't be displayed when the target (textarea) is hidden (or inside a hidden div).
I got it working by doing the job in a setTimeout but it's crappy.
Is there a callback that I could attached to which is fired after the view is unhided (after the transition is completed)?
I found one solution:
Explicitly subscribe to the "isNavigating" observable of the router and add TinyMCE when "isNavigating" value becomes false.
Still : this has the effect of flickering - you see the textarea and then it is replaced by TinyMCE... but this is not a Durandal problem IMO.
Edit 1
Finally, I think the the best solution (for now... follow the link below for the thread on the subject) is to do a setTimeout(xyz(), 0) - I have seen a lot of people using this technique and it prevents the flickering.
https://groups.google.com/forum/?fromgroups#!topic/durandaljs/5NpSwMBnrew
Durandal does have a callbacks when you're using composition - you just put a function on to your viewModel with the correct name. In your case, you would use viewAttached:
Here's the docs:
http://durandaljs.com/documentation/Interacting-with-the-DOM/

mousedown event on options in select with jquery .on

I was reading the documentation of the .on event handler of jQuery and I started playing around with it.
I have a simple <select> element with the multiple attribute set to true.
However, I want the user to be able to select multiple items without having to press the ctrl or shift key(s)
According to the .on documentation, if you specify a selector it will automatically add those event handlers to any new items added inside that container that match the selector specified.
So in my case, I could for example decide to replace the <option> elements available in the listbox, but I still want to have the same functionality for those options without having to rebind those events etc.
One might think that the following snippet should do the trick (atleast, I did):
$('#dropdownlist').on('mousedown', 'option', function(e){
e.preventDefault();
$(this).prop('selected', $(this).prop('selected') ? false : true);
return false;
});
So when a users clicks on an option in that listbox, the default action will be cancelled and depending wether the item is already selected or not, it will invert that selection.
I have created a small fiddle demonstrating this behaviour: fiddle
In that fiddle, the first dropdownlist is behaving as expected, but the functionality is lost when replacing the items. This only works in FF & Chrome.
The second dropdownlist is how I thought it should've been (event handling wise), but that doesn't seem to work besides in Chrome -.-
The functionality is kept when replacing items, because the console will still log '2' when clicking on an item after replacing them.
Can someone explain me why this is happening? Am I doing something wrong?
Please point me in the right direction!
Thanks!
~ Dirk
IE doesn't respect the mousedown event on the option tag itself. You've got to use the OnChange event of the select tag, which is not what you (nor I) want. I was trying to do the exact same thing as you and was stopped at every attempt. I finally gave up and made it a list of checkboxes because I can get the same behavior out of mine that you are trying to do here.
You can see this question for some options, but I never did get it to work the way you are describing.