You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by sharath karnati <ka...@yahoo.com> on 2011/03/21 16:35:51 UTC

Need your inputs.

Hi All,
 
   Planning to create a dynamic form using struts2(similar to http://www.phpform.org/formbuilder/index.php). 
 
  Say I have following headings
 
          Create a Label (heading 1)
                It will display text field to enter label text and 'Add Label' button
          Create a Text Field( heading 2)
                It will display text field to enter type (text, telephone,zip etc)
                It will display text field to enter size of text field entry(this will be the maximum length of textfield) and 'Add Text Field' button
   
   Whenever we press button it will show a row in user form. say I have following form created dynamically
 
<form id="form-details" name="newForm" onsubmit="return true;" action="/form.action" method="POST">
<table width="99%" cellpadding="0" cellspacing="0">
<tr>
   <td>
     <label> First Name </label>
 </td>
 <td>
      <input type="text" title="text" name="field1" size="50" /> 
 </td>
</tr>
<tr>
  <td>
    <label> Last Name </label>
  </td>
  <td>
     <input type="text" title="text" name="field2" size="50" /> 
  </td>
</tr>
<tr>
 <td>
     <label> Last Name </label>
 </td>
  <td>
    <input type="text" title="zip" name="field3" size="5" /> 
 </td>
</tr>
</table>
</form>
 
 
Now form is having 3 elements(field1,field2,field3)...when I submit this form how to get following details in action class
 
  1) How many fields are there?
  2) Each field name, title and size(example: field3,zip, 5)
 
Please advice how to do this using strust2.
 
Thanks,
Sharath.
 


      

Re: [OT] Re: Need your inputs.

Posted by Mohamed SIDI <mh...@gmail.com>.
Hi,

In JQuery you have a function named serailize, this function will serialize
all your form's input I'm not sure about the exactly syntaxe but some things
like "yourFormID.serialize()"

B.W

2011/3/22 Dave Newton <da...@gmail.com>

> Have you considered looking at the jQuery documentation?
>
> Dave
>
> On Tue, Mar 22, 2011 at 9:19 AM, sharath karnati <ka...@yahoo.com>
> wrote:
>
> > Hi Dave,
> >
> >    We are using JQuery + Struts2 + Spring framework(DAO)
> >
> >    Do you have any examples how to process 'Serialize the DOM'
> >
> > Thanks,
> > Sharath.
> >
> > --- On *Mon, 3/21/11, Dave Newton <da...@gmail.com>* wrote:
> >
> >
> > From: Dave Newton <da...@gmail.com>
> > Subject: [OT] Re: Need your inputs.
> > To: "sharath karnati" <ka...@yahoo.com>
> > Cc: "Struts Users Mailing List" <us...@struts.apache.org>
> > Date: Monday, March 21, 2011, 6:10 PM
> >
> >
> > On Mon, Mar 21, 2011 at 6:04 PM, sharath karnati wrote:
> > > Can you please send me links/details for doing this(Serialize the DOM)?
> >
> > What JavaScript framework are you using?
> >
> > (I'd really just try [search engine of choice] first, though--much,
> > much faster than waiting on the list.)
> >
> > Dave
> >
> >
> >
>



-- 


Cordialement

Mohamed

Re: [OT] Re: Need your inputs.

Posted by Dave Newton <da...@gmail.com>.
Have you considered looking at the jQuery documentation?

Dave

On Tue, Mar 22, 2011 at 9:19 AM, sharath karnati <ka...@yahoo.com> wrote:

> Hi Dave,
>
>    We are using JQuery + Struts2 + Spring framework(DAO)
>
>    Do you have any examples how to process 'Serialize the DOM'
>
> Thanks,
> Sharath.
>
> --- On *Mon, 3/21/11, Dave Newton <da...@gmail.com>* wrote:
>
>
> From: Dave Newton <da...@gmail.com>
> Subject: [OT] Re: Need your inputs.
> To: "sharath karnati" <ka...@yahoo.com>
> Cc: "Struts Users Mailing List" <us...@struts.apache.org>
> Date: Monday, March 21, 2011, 6:10 PM
>
>
> On Mon, Mar 21, 2011 at 6:04 PM, sharath karnati wrote:
> > Can you please send me links/details for doing this(Serialize the DOM)?
>
> What JavaScript framework are you using?
>
> (I'd really just try [search engine of choice] first, though--much,
> much faster than waiting on the list.)
>
> Dave
>
>
>

Re: [OT] Re: Need your inputs.

Posted by sharath karnati <ka...@yahoo.com>.
Hi Dave,
 
   We are using JQuery + Struts2 + Spring framework(DAO)
 
   Do you have any examples how to process 'Serialize the DOM'
 
Thanks,
Sharath.

--- On Mon, 3/21/11, Dave Newton <da...@gmail.com> wrote:


From: Dave Newton <da...@gmail.com>
Subject: [OT] Re: Need your inputs.
To: "sharath karnati" <ka...@yahoo.com>
Cc: "Struts Users Mailing List" <us...@struts.apache.org>
Date: Monday, March 21, 2011, 6:10 PM


On Mon, Mar 21, 2011 at 6:04 PM, sharath karnati wrote:
> Can you please send me links/details for doing this(Serialize the DOM)?

What JavaScript framework are you using?

(I'd really just try [search engine of choice] first, though--much,
much faster than waiting on the list.)

Dave



      

[OT] Re: Need your inputs.

Posted by Dave Newton <da...@gmail.com>.
On Mon, Mar 21, 2011 at 6:04 PM, sharath karnati wrote:
> Can you please send me links/details for doing this(Serialize the DOM)?

What JavaScript framework are you using?

(I'd really just try [search engine of choice] first, though--much,
much faster than waiting on the list.)

Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Need your inputs.

Posted by sharath karnati <ka...@yahoo.com>.
Hi Dave,
 
  Can you please send me links/details for doing this(Serialize the DOM)?
 
Thanks,
Sharath.
  

--- On Mon, 3/21/11, Dave Newton <da...@gmail.com> wrote:


From: Dave Newton <da...@gmail.com>
Subject: Re: Need your inputs.
To: "Struts Users Mailing List" <us...@struts.apache.org>
Cc: "sharath karnati" <ka...@yahoo.com>
Date: Monday, March 21, 2011, 1:25 PM


On Mon, Mar 21, 2011 at 11:35 AM, sharath karnati wrote:
>   1) How many fields are there?
>   2) Each field name, title and size(example: field3,zip, 5)
>
> Please advice how to do this using strust2.

It won't have anything to do with S2; you'll either need to:

* Serialize the DOM info (most likely using a third-party JavaScript
library) and send everything.
* Know the field information on the server side and recover it based
on the field name.

Dave



      

Re: Need your inputs.

Posted by Dave Newton <da...@gmail.com>.
On Mon, Mar 21, 2011 at 11:35 AM, sharath karnati wrote:
>   1) How many fields are there?
>   2) Each field name, title and size(example: field3,zip, 5)
>
> Please advice how to do this using strust2.

It won't have anything to do with S2; you'll either need to:

* Serialize the DOM info (most likely using a third-party JavaScript
library) and send everything.
* Know the field information on the server side and recover it based
on the field name.

Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Need your inputs.

Posted by Mohamed SIDI <mh...@gmail.com>.
Hi,

so I will explain what you have to do

suppose you have three fileds in your form with respectively have the names
filed1, filed2 and filed3

in your struts.xml file you shoud paramter your action like this :

<action name="yourAction" class="yourActionClass" method="execute">

<param name="allowedParameters">
                filed1, filed2, filed3
 </param>

and in your action class you shoud create the getter and setter methods for
each filed

Best wishes.

2011/3/21 sharath karnati <ka...@yahoo.com>

> Hi All,
>
>    Planning to create a dynamic form using struts2(similar to
> http://www.phpform.org/formbuilder/index.php).
>
>   Say I have following headings
>
>           Create a Label (heading 1)
>                 It will display text field to enter label text and 'Add
> Label' button
>           Create a Text Field( heading 2)
>                 It will display text field to enter type (text,
> telephone,zip etc)
>                 It will display text field to enter size of text field
> entry(this will be the maximum length of textfield) and 'Add Text Field'
> button
>
>    Whenever we press button it will show a row in user form. say I have
> following form created dynamically
>
> <form id="form-details" name="newForm" onsubmit="return true;"
> action="/form.action" method="POST">
> <table width="99%" cellpadding="0" cellspacing="0">
> <tr>
>    <td>
>      <label> First Name </label>
>  </td>
>  <td>
>       <input type="text" title="text" name="field1" size="50" />
>  </td>
> </tr>
> <tr>
>   <td>
>     <label> Last Name </label>
>   </td>
>   <td>
>      <input type="text" title="text" name="field2" size="50" />
>   </td>
> </tr>
> <tr>
>  <td>
>      <label> Last Name </label>
>  </td>
>   <td>
>     <input type="text" title="zip" name="field3" size="5" />
>  </td>
> </tr>
> </table>
> </form>
>
>
> Now form is having 3 elements(field1,field2,field3)...when I submit this
> form how to get following details in action class
>
>   1) How many fields are there?
>   2) Each field name, title and size(example: field3,zip, 5)
>
> Please advice how to do this using strust2.
>
> Thanks,
> Sharath.
>
>
>
>




-- 


Cordialement

Mohamed