In the form I am creating, I have lots of buttons that depending on the data state, are disabled or enabled.
I have an issue where, in certain situations, my "Reset Form" button is the only enabled button left on the screen, so it accepts the "enter" keypress... and blows away all the user information.
I need to retain usage of the enter key with the other fields, but I'd like to hide this reset button from ever being seen on the page DOM as the "firstnext" button to invoke on enter keypress.
I've seen a few solutions w/ javascript, but I was hoping there was a native JSF way to do this, or even with an extension library. Taborder was of no help... Best I could come up with that works is a hidden button on the page dom in front of the reset button that dev/null's. There's gotta be some sort of cleaner solution.
Thanks in advance.
Turns out, if you declare a button as type="reset" it prevents firstnext recognition. You can still have an action="#{bean.resetFields}" method being called and it will give you the best of both worlds.
Related
I am using the extlib Dialog component to display some data. I want the user to only close the dialog via a button I have in it.
I can't see any option to disable the close icon in the title bar. Can someone point me to the documentation on doing this? So far I've checked the wiki + extlib book (maybe I missed it?).
css rules, again! As far as I can see there's no "native" way to get rid of that close button (and to be honest, I don't think it's a really good idea to do so; see below). But using some css you of course can hide anything you want on your page.
Just give your dialog some custom styleClass; at runtime this custom class is then added to the dialog's outer div-container.
The close button itself is an link inside a span; the has tow style classes, one being "lotusClose".
Finally adding this piece of code to your style sheet will hide the button:
div.yourCustomClass a.lotusClose {display:none;}
Caveat:
The "close" button is there on purpose. And instead of hiding it I would rather add some kind of validation code to your dialog's close event. There are numerous examples, but maybe you just want to refer to dojotoolkit.org's reference for
dijit.Dialog
(section "Forms and Functionality in Dialogs).
Btw: since the dialog is based on dijit.Dialog you may also want to browse stackoverflow's dojo section.
I've been doing searches trying to find help on this, but so far all I have found is how to set options for popping up a SharePoint modal dialog box from custom code.
However, I haven't created any custom web parts to display modal dialogs. What's happening, is if someone clicks the upload document button in a library, the upload document modal dialog comes up, but the ok and cancel buttons are half off of the bottom of the box. Users can click on them, but it just doesn't look very good.
I started playing with the CSS to make the modal dialog box bigger to reveal the buttons, and that works for the most part, but the real problem is the grant user permission dialog box.
When that is clicked, it doesn't show the ok and cancel buttons, and maximizing the dialog box doesn't reveal them. The user has to hit tab about 5-10 times before the focus moves to the ok button and is then clickable.
I would post an image, but I don't have enough reputation to do so.
Has anyone come across this? It seems very strange that the out of the box setting would have this problem.
The CSS that I use to adjust the height and width of the modal dialog is:
.ms-dlgFrame, .ms-dlgContent, .ms-dlgBorder, .ms-dlgFrameContainer
I'm just trying to set the height/min-height values, but I haven't had much luck.
We're using Internet Explorer 11 to view the pages.
Stevangelista actually pointed me in the right direction, I wish I could mark comments as answers, and since I'm new I can't upvote the comment, but here's the solution:
I am using a customized master page, and that comment had me take a look at the elements in the page.
Since the master page is being used in the dialog boxes as well, I used the s4-notdlg class to remove parts that weren't needed in the dialogs. Those parts were pushing the buttons below the bottom of the screen.
I'm not a css expert, so there may be ways of keeping those parts and still have the buttons accessible, but the particular issue I was trying to fix was resolved by using the s4-notdlg class to objects in my custom master page.
I have a long form, and the client have to scroll vertically the screen to see all fields.
But, every time one of those components with the property update=#form is fired, the screen get back to the top position.
So, the question is:
There is a way to keep the scroll bar in the same position after an update=#form ?
Important: The scroll bar back to the top only in the first update=#form, after that, the screen keeps the current position.
I am not sure if it's a bug or I am doing something wrong that is causing that behavior.
And yes, i really have to update the whole form
e.g.
<p:commandButton id="btnVerifyLogin" update="#form" value="Verify"
actionListener="#{demandController.VerifyLogin()} />
I had this issue before, where I had to update the whole form.
What I have learned that when I update the form containing the button that has been pressed (like your Verify button), the browser somehow loses the focus on that button and just scroll back to the top.
I came up with a workaround.
<p:commandButton id="btnVerifyLogin"
update="#(form :not(#formId\\:btnVerifyLogin))"
value="Verify"
actionListener="#{demandController.VerifyLogin()} />
Basically I update the form but not the button, this way the browser keeps the scroll as it is.
Others would suggest that onstart we can call var scroll = $(window).scrollTop(); in order to preserve our scroll position, and oncomplete we call $("html").scrollTop(scroll);, but this won't work since the oncomplete won't be triggered since the button is updated inside the form!
Again this will work only with Primefaces 4, and recently I avoid updating full forms, I prefer to use selectors.
Hope this helps.
I have an android spinner which I call via the performClick method to show a list of items (the actual control is hidden from the user and is called from a checkbox, too complex to explain why I have done it this way).
If I do not want an item in the list, how can I dismiss the popup by clicking on the black area?
Does this make sense? :/
Edit: Sorry, forgot to mention that the users will not be able to operate the bottom buttons (device is going to be galaxy tab) as they will be covered up with protective layer due as they will be outdoors.
usually such a control is dismissed using the back key in the android applications. So I would suggest that you find a way to do it the same way on your control.
'Esc' button should do the same job..
Currently working on a mobile app in J2ME and have questions with ChoiceGroup radio button answer options. Any suggestion on how to make it so that no default answer is selected? We've tried:
cg8.setSelectedIndex( -1, true ); But get an out of bounds exception error
and
cg8.setSelectedFlags( boolean[] ) with all false, but also get another error.
To get around this, we've also tried creating an invisible radio button and have that set as selected, but couldn't find a way to make an invisible radio button either.
Any thoughts or suggestions would be great appreciated!!
It sounds to me like the platform is enforcing an appropriate convention, although I must apologise for taking a purist standpoint here; this won't really answer your question.
Radio buttons are used when there are multiple exclusive choices, of which one must be made; it makes a certain amount of sense, therefore, for the user interface to ensure that something is always selected. Ideally, the initial selection in a radio group should always be a safe and sensible default.
As far as I know, the only way to not have any radio button pre-selected is to draw the control yourself. Re-implement a radio button list using a Canvas or a CustomItem.
It's a lot of work, unfortunately.
You should look into LWUIT as it may have an intermediary solution.