PDA

View Full Version : Submit a form which has a grid



jun.sumi
6 May 2011, 1:29 PM
Hello guys,

I have such a complex form panel which I need to submit.
We use Extjs 3.3.1 with Java + Struts 2.

I know how to submit a form and get the values correctly in one simple java class. The problem is when my class has a list(or an array) as an attribute.

I've attached a picture of my window just for example.

So, into the tab, there is a form which after clicked in "confirmar" all values will be set into the grid below.

So, I need to submit all fields which are out of the tab and all itens of the grid.

I tried to put an hidden field to store the grid values an array object, but the server could not set the values correctly.

It is very hard to explain my problem here, but I wish someone would be able to help me.

Thanks.

pbyhistorian
6 May 2011, 2:01 PM
My form has several EditorGridPanels on it and I didn't know how to submit it to Java either.

This may be crude but:
1) A Submit button invokes a Javascript function that collects all of the form fields and GridPanel values into a JSON object.
2) The Javascript function uses Ext.Ajax.Request to submit the JSON object to the Java server.
3) A Java routine on the server routes the JSON object to the appropriate Java method.
4) The Java method parses the JSON object and processes it.

This would have been far easier on a Coldfusion or (maybe) PHP server, but I have a legacy server running JVM 1.3.1 - had to write the Java JSON functionality from scratch. I hope someone has a better way to solve your challenge.

P.S. Though I like JSON better, it may be easier to use XML with Java. It may have been even easier to implement as a web service.