How to submit autocomplete select value into Textfield in Tapestry5? - java

I've got a Textfield with autocomplete and zoneUpdater mixins. Based on the typed value, I call service which returns new values for the autocomplete select. So far, so good. Big problem for me is that autocomplete select doesn't submit chosen value. I want to update different zone, based on this value. The way it works now is that I have to submit the whole form and reopen again. But that's not what customer wants, it should do it on fly without submitting the form. Is there any solution for this? Thank you.

I want to update different zone, based on this value.
I 've tried to do this with your setup and actually worked but the drawback is that the value I get as the CHANGE event of the input is what the user typed (not what the user selected from the autocomplete list).
To get the value from selected from the autocomplete list (although I 've not tried it) you should use the callback parameter of prototype's Autocompleter. Take into account that in order to do this you should rewrite a new Autocompleter mixin of your own as the Tapestry's built-in autocomplete mixin is not honoring that callback parameter.
I 've also checked out the tapestry-jquery's Autocomplete mixin and although jquery's autocomplete supports a autocompleteselect event tapestry-jquery is not handling it in it's instantiation.
I 've not checked the chenille kit autocomplete mixin which maybe can help you, I really don't know.
As far as I know you should develop your own Autocomplete mixin based on any of these and add to it the selected item event functionality.

Related

Adding a checkbox to a component in Wicket

I have a Text field that when you write, autocompletes with the possible choices you have based on what you are writing.
There's a fixed list of favorite choices, and I have to add a checkbox to the component so the user can choose whether to see only the favourite choices or all the possible choices.
I asked google, but I can't find how to modify a component at that level.
Does anybody have hints or somewhere I can take a look at a good example?
Add an AjaxCheckBox next to the text field. When the autocompleter asks the server for values use the AjaxCheckBox's model object to decide what to return.

GWT- PopupPanel with search?

I am looking for a way to create a popup dialog box when a user double clicks a textinput field that will contain a scroll-able list (from database table) where the user can select a field, hit ok, and have it placed into the textbox when popup closes.
The other major requirement is to have a filter/ or search field in the popup to aid the user in finding the correct option to select from quicker.
What is the best way to implement this?
Modification to gwt's popup panel? maybe a JOptionPane? are there any simple solutions already designed for free commercial use?
You could implement this with a com.google.gwt.user.client.ui.PopupPanel. You can make a PopupPanel that contains a ListBox with your data from the database, along with a OK button. When a user selects a value and hits OK, you should utilize an EventBus along with a custom Event that will pass the value to the field on the page. The page will have an event handler that will catch the event and put it into the field.
Another option is to use a com.google.gwt.user.client.ui.SuggestBox. It is a box that autocompletes / suggests values as you type, kind of like the Youtube search bar.
I can offer more resources to help you accomplish this, if you'd like.

Wicket, how to lazy-load DropDown choices on click?

I have a lot of DropDownChoice components with many items in a form, and on loading the form, I'd like to display only the saved selected options. When the user clicks on a DropDownChoice, I'd like to ajax-load the full item list on the fly.
Can this be done?
Add a OnChangeAjaxBehavior to your dropdown-component. Override the onUpdate-method and add another component to the target. The chosen value of the dropdown-component is inside its model.
Update: Okey, I think I know what you're trying to achieve. Add an AjaxFormComponentUpdatingBehavior to your dropdown component with "onclick" as constructor parameter.
Override the onUpdate-method and add your dropdown component to the target. Before you do that, update the dropdown model, so that it now contains all values.
If you have a lot of options to show then using <select> is not the best option.
Better check http://ivaynberg.github.com/select2/ or http://livedocs.dojotoolkit.org/dijit/form/FilteringSelect or any other JS based component which can load options on demand via Ajax.
Maybe you could go with the AjaxEditableLabels... Using the AjaxEditableChoiceLabel from Wicket Extensions, you'll get a compponent that displays the current value as a Label until clicked and the changes to a DropDownChoice via Ajax. That should be pretty much like the solution you're looking for.

How to restrict user from going to Next Page if all the fields are not populated in Eclipse SWT

I have a requirement like this:-
The user shouldn't be allowed to traverse to the Next Page in case he has not entered all the required parameters in the First Page itself. Also, in case he has entered something erroneous he should be displayed the warning and restricted from going to the Next Page. This needs to be implemented using Eclipse Plugin Developement using JFace/SWT.
Check your GUIItem.value() for empty on the Next Page button action or deactivate the button until the required fields have data.
use WizardPage.setPageComplete(boolean complete) method (easy way), or use JFace databinding. Even better if you wire databinding with org.eclipse.jface.databinding.wizard.WizardPageSupport.
Override the ispagecomplete method to return true only when all the values in your wizardpage are complete. When the user edits any value ensure that you have listener on these fields that call getContainer().updatebuttons() This should work for your requirement.

manual swing data binding

I have rather big swing interface (several textboxes, comboboxes, checkboxes, custom popup dialogs etc) and a data model that has to be changed when ui control changes: new text is entered into text box, check box is clicked, etc.
The question is: what is the best practice to organize update+validation of input values.
Unfortunately I can not use binding framework like beansbinding.
Add appropriate listeners to the components, and update the model when the events are fired.
Or design your UI so that everything is saved to the model only when a Save or OK button is clicked. This also helps with validation, because you just need to validate everything at once, when the button is clicked.
Combine the answer of JB Nizet with validation in your components, for example by using JFormattedTextField (or an enhanced version of this). You can use the JFormattedTextField also as editor for JComboBox instances. You can add validation to JSlider instances.
In short, provide immediate feedback to the user when he types in an invalid value. That combined with validation on the model side makes a good application.
This can be compared to a modern website: client-side validation with javascript to give the user immediate feedback + server-side validation for validation which does not go through the UI, or to avoid nasty users bypassing your client-side validation

Categories

Resources