I have a wizard comprising of three pages page1 , page2, page3.
I'm in page 2 and I press "Next" button , where some validations for duplicate creation needs to verified based on inputs form page1 and a selection inputs entered in page2.
Which method should i override inorder to include my validations and pop up a message box(complaining about duplicacy) on click of Next button of page2.
You can override WizardPage.getNextPage() and return null to prevent the next button from operating.
It is more usual to validate the user input as it happens and call WizardPage.setPageComplete(false) to disable the next button completely until the page is valid.
Call WizardPage.setErrorMessage(msg) or WizardPage.setMessage(msg, type) to display messages.
Related
When I click a add link it opens a popup and I cancel the popup then it goes to the previous place.
private class CancelHandler implements ClickHandler {
#Override
public void onClick(ClickEvent event) {
if (popupPanel != null) {
popupPanel.hide();
getUiHandlers().getPlaceManager().revealPreviousPlace();
//I added this code, after the popup closes, the url is not resetting. So I revealed to the previous place.
}
}
}
One list page shows a list of records, Here one validation is handled i.e If there is only one record in a list page it will automatically reveal to the display page. In display page (i.e popup) cancel button is present, If I hits the cancel button it is cancelling but it again opens the display page. If I comment the below line of the code (getUiHandlers().getPlaceManager().revealPreviousPlace();), It is not opening, but I want that line for this purpose, after clicking cancel button I need to reset the url for that I am revealing the request to previous place.
Can anyone say how to fix this issue?
As far as I know PlaceManager#revealPreviousPlace() doesn't exist.
I don't know the exact behavior you are looking for. If all you want to do is go back to the previous URL, you can call com.google.gwt.user.client.History.back(). Note that this is the same as the user clicking the browser's back button. For more safety, I would recommend having the cancel action always redirect to the same place.
How can I validate that not more than one checkbox is selected in a listview (repeater)?
I have a Form with a ListView in Wicket with following structure:
line 1 to n: AjaxCheckBox and TextField
Both elements are connected by CompoundPropertyModel<SimpleType>. POJO SimpleType looks like:
public class SimpleType {
private boolean enabled;
private String value;
Getter/Setter...
}
If more than one checkbox is selected, form should reject any changes. So the user must deselect the selected checkbox first before he can choose another checkbox.
I tried with surrounded CheckGroup with IValidator<Collection<SimpleType>>, but I need to change AjaxCheckBox to component Check. In this case Check seems to be not updated with state enabled from CompoundPropertyModel.
Do I really need a Validator or Visitor for this case? How to implement them?
Since radio is not an option here is a simple solution that should work:
For validation use IFormValidator that visits all AjaxCheckBox-es.
For immediate UI response I'd use plain JS that unchecks the previous checked checkbox. This would fire Wicket Ajax call to unselect it at the server side too.
Once the complete form is submitted the IFormValidator would do its work.
I created one app using JavaFX. When user select any value from Combobox(Dropdown), login popup will display. and on that login window there are two options Login and Cancel.
So the problem is when a user selects any value from the dropdown, login popup will appear. Now user cancels login popup.
If a user wants to open login for the same value selected in dropdown he/she needs to select another value cancel login and select again previous value.
If the user clicks on the dropdown and selects same value event won't trigger.
My code is like following
FXML element
<ComboBox fx:id="userComboBox" onAction="#onUserUpdate" promptText="Select User"/>
Method execute on event trigger
#FXML
public void onUserUpdate() {
//Displaying login popup
}
So I want to trigger the event on select value from the Combobox no matter user is selecting the same value or different value.
Thanks :)
I have 4 Wizard pages , say page1 , page2, page3 and page4. Page1 consists of 3 radio buttons. So based on the selection of radio button, one of the 3 pages should be opened.
i.e. if I select the 1st radio button and press Next , then page2 should be opened.
similarly 2nd radio button- page3
3rd radio button - page4
How do I achieve this?
Override the getNextPage method of your Wizard or WizardPage classes.
For Wizard the method is:
public IWizardPage getNextPage(IWizardPage page)
You are given the current page and return the next page.
For WizardPage the method is:
public IWizardPage getNextPage()
The default behavior of WizardPage.getNextPage is the call the Wizard get next page:
public IWizardPage getNextPage() {
return wizard.getNextPage(this);
}
There are also similar getPreviousPage methods.
I have a web page in jsp extension , which is built using jsf. There are command links for some user ids, i.e. every user id is a command link. When a user id is clicked, it goes to another page, where some action can be done.
<h:commandLink value="#{user.userId}" rendered="#{bean.myName == 'ID1'}" action="#{bean.userIdHasBeenSelected}" immediate="true"/>
Now if the action returns a string called "notDone", i want to show an alert pop up in the jsp and the page will not be navigated and will remain in the same page. But , if the action returns the afore mentioned string , the page will just be not navigated..it will not be reloaded or refreshed..then how can i use window.onload here ?
If not window.onload , then is there any other way of doing it ? One point to be remembered is that, the action is evaluated at java side.
Any suggestions will be deeply appreciated.