GWT + Editor: Avoid removing violation messages and wrong input - gwt

We implement in our GWT/GXT project displays that contain in most cases a filter form and a grid to show the filtered data. Displays are implemented with UiBinder and the "Gwt Editor Framework".
The user wants to have validations on the filter form. To do the validation we use JSR303 bean validation. The validation must apply on each change of a field in a filter form. The user wants also to have a kind of automatic fill a field based on the input in a second field (lets say a number range from and to). That works all perfect - but...
We struggle in a particular situation:
The user starts to type in some data in the filter form.
He puts a wrong value in a field that has to be parsed into a date (for example).
He continues typing into following fields which then cause an automatic prefill of a second field.
The result is currently, that the wrong value he typed into the date field is removed and the violation message as well.
Our current implementation will do a flush() to get the values the user typed in already. After that we fill a attribute in the model (based on the input) and do an edit(model). If there are some violation messages because of a wrong input in a different field in that filter form, the value is removed. That happens on field that need a parse (date, time, number).
The question is now:
Is there a way to keep the wrong value and the violation message as well?
Thank you for any replay!

Related

a number is required in the selection criteria when using a parameter

I am new to CR, and I think this is a complicated question. When a user runs the report, I want the user to input either nothing - which will get everything, or to input the values for that field - to get those specific values. Let me know if I am approaching this right.
I am trying to use a formula in the record selection formula editor. This formula references a parameter. I am trying to use WrkOrder.Center field - which is a number - in my selection criteria.
I am getting the error "a number is required here" in the record selection formula editor. I need to do a totext or cstr ? It just seems to still be incorrect.
if the center is blank then get all centers, else get the selected center input in the parameters by the users running the report.
if {?Center}="" then true else {?Center}=cstr({WRKORDER.CENTERNBR})
if {?Center} = "" then true else {?Center}={WRKORDER.CENTERNBR}
parameters to get what is either input or get all centers
First thing to check is the data type of your parameter and the data type of database field to ensure they match.
If you edit your parameter the first three controls on the form at the top are Name, Type, and List of Values. The Drop Down Box for Type will identify the data type of your parameter.
To identify the data type of your database field, find the field in the Field Explorer and if you don't already see a data type listed next to the column names for each table, right click on any field name and click "Show Field Type" and this will toggle the display of the field data type on and/or off. Its usually off by default I believe.
In order to use a comparison with the = operator, these two objects must have matching data types. You aren't able to change the data type of a database field, but you can change the data type of your parameter to match it.
Hopefully this will fix your error. The most common cause of the error message you are receiving is when one field is a Number type and the other is a Text type. Functions that convert the data will work in formula fields, but usually will continue to throw errors when used in selection expert formulas.

"The data has been changed" error when editing underlying record in Access VBA

I have a form in Access where I have 2 unbound multi-select listboxes, with some code to move items between them.
Each of the fields in the table which are shown in the listboxes are boolean values - if the value is true then the name of that field shows up in lstSelected, and if false shows up in lstUnselected.
The listboxes have a RowSourceType of Value List, and the value list is generated programatically by looking at the underlying record and constructing a string with the field names where the boolean values are true for lstSelected and False for lstUnselected.
On the form I have two buttons, cmdMoveToSelected and cmdMoveToUnselected. When I click on cmdMoveToSelected it changes the boolean value of the underlying field for any selected items in the lstUnselected listbox from false to true by executing an SQL string, then rebuilds the value lists for both of the listboxes.
I have all of this working just fine. If I do a me.lstUnwanted.requery and a me.lstwanted.requery then everything moves and shows up correctly, and the underlying fields are edited correctly, BUT when I click on anything else on the form I get the error:
The data has been changed.
Another user edited this record and saved the changes before you attempted to save your changes.
Re-edit the record.
Now I've found a way around this (jobDetailsID is the primary key of the record being dealt with):
Dim intCurID as Integer
intCurID = Me.JobDetailsID
Me.Form.Requery
Me.Recordset.FindFirst "JobDetailsID = " & curID
This requeries the form and then moves back to the current record, and this gets rid of the error, however it causes there to be a delay and the form to flicker while it opens back at the first record, changes back to the correct record and repopulates the list boxes.
Is there a way to do away with this error, or get it to trigger programmatically so I can catch it by turning the warnings off via vba?
Thanks in advance.
Maybe it helps not to bind the form to the table being altered by cmdMoveToSelected, but to a query that doesn't contain all the boolean fields. If cmdMoveToSelected alters one or more boolean fields, the record is changed, but the query result isn't. Not sure if it's sound though.
It also sounds a bit like a design problem rather than a form problem, storing options in boolean fields instead of into a related table.
Probably the best solution would be to not directly update the current record in the table while the Form is dirty. Instead, update the values of the fields within the form itself (Me!FieldName) as the items are moved from one List Box to the other, and let the form write those values back to the table as usual.
I seem to have fixed it, though the fix doesn't make a great deal of sense to me.
I added in a Me.Refresh to the button click code, after I had requeried the two listboxes and it appears to have stopped the message from coming up. However this only works when I have the JobDetailsID textbox visible on the form (though I expect this is arbitrary and any field-linked textbox would work).
Can anybody explain to me why this works? I'd like to understand fully when to use requery, refresh etc
I've had this sort of thing happen when I've left the form RowSource query hanging in place after converting the controls to unbound textboxes, etc. The general Form rowsource query (to bring in all fields I might possibly end up using) provides me with a query-list identical to the table fieldnames, making it simple to select them for control-names as needed. Works fine, but you have to remove the form rowsource query after all the names are matched-up. (After which DLookup and BeforeUpdate works for getting and storing values and changes.)

Popup window for complex structured data in an extjs form field

I need to build the following form field. Let's take the case where in a form I have multiple fields. Two of them are "last name" and "first name". Instead of the classic way when these field will show seperatley I want a single fields thatt shows when completed like a text field with value a concatenqtion of e two values ( ie "michael jackson"). When I click on the field an window (like a picker date) will popup haing a form with the two fields.
Unfortunately i do not know where to start from:
what class should I derive
how should I store the value in the form ( two hidden values or just a serialized value of the fields).
I might have complex structure with 5-6 fields in this picker popup.
I would extend Ext.form.field.Picker. In the createPicker() method you can crate whatever combination of fields an components that you want.
Re: storage of data, I'd serialze the values in the one field. Then you can treat reads and commits in the same way (and you can always manipulate the data later.
Here's an example that I did a while back: jsfiddle.net/existdissolve/wMcQk/

get text data from end user, with one field having uneditable list of drop down values(others input by end user)

I have a requirement, where some 14-15 fields of data have to be asked from the end user and some processing has to be done for those values.
But one of the values should be pre-filled with a drop down list of values, and user can only select one of the values in that list. Also, the user can add a suffix value to this fixed value(by fixed value i mean value in drop down list selected by end user). So this parameter when sent to the server for processing, is fixed value+suffix.
I want to know if this type of form processing can be done using bean/jsp. Or with any other method.
If you could give me a code sample for implementing this (whether bean or other method) then that would be great.
The processing that has to be done after the user submits all 14-15 values is written as java code. I should be able to invoke this code to do processing.
Of course it can be done using servlets/JSP.
You need to generate apage containing an HTML form. This form will have to contain a select element withh all the fixed options, and a text input where the user has to enter the suffix. When submitted, the servlet/JSP will have to get the submitted values from the request parameters, and do its processing.
A code sample would be too hard to give you. You need to read a whole tutorial about HTML forms, the servlet API and how JSPs work.

How to make a field "autocomplete"?

I can't figure out how to make a field autocomplete in ATK.
I guess it has something to do with the type "reference" but still not sure.
Suppose I'm looking for a client name in a "line" type field, then the autocomplete should list me all/topXX matching names.
Scenario 1:
Once I hit [Enter] I'd need all that row from DB loaded in a form fields so I can edit the record.
I guess this requires getting the client ID first then posting to an "edit" page then calling "loadData()" method for that ID and populate fields.
Scenario 2:
I'm assignig a job request to a client. First I find the client then I could store its ID in a hidden field to be posted then.
Any advice?
TIA
I would suggest you to go with 2 forms. First form with a single field, and when field is changed it automatically reloads second form including the parameter.
You will also need an autocomplete field. Autocomplete is somewhat buggy in 4.0, but it have been polished up in 4.1 by using a technique in http://jqueryui.com/demos/autocomplete/#combobox
For use with models and controllers and also dropdown, example is here:
http://codepad.agiletoolkit.org/reloadform
Alternative example:
http://demo.atk4.com/demo.html?t=22
Since 4.1, you can also use autocomplete fields instead of reference:
$form1->addField('autocomplete','user');