Spring MVC 2.5 Command object value is changed on form submit - spring-mvc

I have a string variable in command object which is a hidden tag in my jsp.
An on click of a button i'm setting this variable with a value(example "test") and submitting the form.
On form submit, I get the control to my Validator.validate() method.
In this method the value of the variable in command object is changed that is comma is getting appended to the value(Example "test,").
I have checked debugging at the java script side, correct value is set to the variable there(it doesnt have the extra comma appended to it) but when it reaches the validator its value is changed.
I'm not understanding why only that particular variable value is getting changed while all other values are set correctly.
Please suggest how should i rectify this

Are there two form fields with the same name. When two form fields have the same name - the values could get appended in a list.

Related

How to print Activiti workflow task's values into Alfresco Share

I have a workflow to manage employee petitions, that starts with some fields at starter form. The next task, allows a responsable user to approve or reject the initiator user's petition.
I want to show the values of starting form into the approve/reject form, so I created a custom .ftl file for every field that I want print the label and the value. Now I have hard-coded the values to the this:
My problem here, is how to get the value from the first form and print it at the second form (values that I need are where says "200€" and my name).
I'm using Alfresco Community 5.1 and his own Activiti.
Thanks.
Solution 1 : keep IDs of the fields identical in both the forms. this will make the field editable in the second form.
Solution 2 : create a process variable, set its value after the first form has been submitted. then, in the second form display the value of the process variable.

getting textfield output partly unvisible

In a Drupal content type a need to get the output of a field partly unvisible. These are bank account details, the IBAN.
Normally the field shows 1234567. I need to get xxxx567. I need to show only the last 3 numbers/letters.
Also I need this output in field edit form.
On the display end you could change the output using a simple PHP function in the theme template by grabbing a substring of the field's last three digits and concatenating it with "xxxx" before printing.
You might also consider doing this at the formatter level by using the 'custom formatter' module perhaps?
https://drupal.org/project/custom_formatters
To do this on the edit screen is trickier. I suppose you could do a hook form alter to use PHP to change the field value, but I am afraid you will rewrite the field value when you save the node with the 'xxxx' instead of the real data.
I wonder if it would make sense to 1.) hide the actual field, 2.) create a dummy field that displays the text formatted as "xxxx567" to the user, and 3.) write some javascript that populates the hidden field with the visible field's value if it is changed. Presumably the form would still throw values if the hidden field did not meet formatting requirements.

Dynamics Ax 2012 Overriding empty values of a field

I have some custom fields in the SalesTable form where I have overridden the lookup method to fill a combobox. I have also overrode the form's initValue method of my custom data source to automatically fill in the default values of these fields when no value is present.
My issue is this: one of those fields will not be editable by the end user and requires a value. Not all records have this value filled in currently, so when an existing record is edited AX throws an error because the field requires a value and can't be modified. I basically need to detect when the form starts up whether or not there is a value and fill it in if not. Any advice on where/how to do this?
Depending on the kind of data that you want to store in that field you could fill the old records field with a default value so you don't need to create a validation.

How to copy the description value of a lookup to another field?

I have a grid called myGrid. The column A of myGrid is a lookup that shows 2 values: the code, and the description.
I would like to copy the selected item's description into a second column of myGrid.
What would be the best way to do this?
I have encountered this sometimes ago and the solution I found is a bit complicated but works fine.
I had to create a form from scratch which is currently used in the lookup.
When calling the form in the lookup() method, don't forget to put "element" in the arguments.
In the init method of the new form, use element.selectMode(YourTable.Code) to specify which field will be selected. Override the closeSelect() method of the new form and make it call a parm method located in the caller form. This parm method will set the YourTable.Description field of the current record. Send the Description related to the record from YourTable selected by the user in the lookup.
The new form should be a window of type Popup, with the toolbar hidden and always on top. Its datasource should be YourTable.
Call the new form from the lookup method (or better, from a method at the table level called from the lookup method) using ClassFactory.formRunClass(args).
I found a 'simple' solution: i've to simply override the method modifieldfield

How do you pass a date value to BIRT report via querystring

I have made a static html page (called start.jsp) containing a form where the user select 2 date ranges and this form has date pickers for those text boxes. When the user submits
the form, it should take them to the BIRT report that I have designed. It SHOULD
pass the 2 parameters that my report needs (start date and end date).
Here is the querystring that gets appended to the URL
birt-viewer/run__report=Business_Activity_Monitoring.rptdesign &FilterStartDate=2000-01-01&FilterEndDate=2009-01-01
I get an invalid date error:
org.eclipse.birt.report.exception.ViewerValidationException: The parameter "FilterStartDate" is invalid. The value "06-08-2010" is invalid with the type "dateTime".
How is it that if I remove the querystring completely, then BIRT will prompt me to enter the
start date and end date (screenshot attached).
I enter the exact same data that the form tries to send and it works!?
This proves that my date string is correctly formatted but yet it will not accept them if they
are sent to the BIRT report via the querystring? Seems like it has a problem with the
fact that its a string in the first place.
I have correctly set up these report parameters in my BIRT report. I have also tried changing them
by specifying the "Format as" value to be a "custom" YYYY-MM-dd but this didnt work.
Is it even possible to send date parameters to a birt report via querystring?
Im guessing the solution will involve converting these strings to dates within the birt report's "script" tab.
but I dont know how to access querystring variables from here or how to set report
parameter variables.
Thanks
-Tommy
Your report parameter probably has a data type of "DateTime". As such your passing of just the date is not sufficient. When you use the OOTB parameter request pages this is accounted for under the covers. Either change your parameter data type to "Date" or append a time signature to your parameter being supplied to the report via your page (i.e. 2009-01-01 00:00:00). Either approach should do the trick.
Good Luck!
The following is the format BIRT appears to use for validation of parameters:
DEFAULT_DATETIME_FORMAT = "yyyy-MM-dd HH:mm:ss.SSS"
So if you pass in date/time as it should work
&mydate=2009-11-22 00:00:00.0
If the start date parameter you are passing is 2000-01-01, why is it giving you an error message saying 06-08-2010 is invalid? It looks as though the date parameter is being set elsewhere within the report, either as a default value or possibly within an event script.
Check your date format; remember that MM is used for month and mm for minutes.
Also check this solution, found at the Eclipse Community Forums:
Try this in the URL:
&mydate=22/11/2009&__islocale=mydate
Replace mydate with your parameter
name. The __isLocale parameter
specifies that the parameter has been
localized.

Resources