gigaZhang / struts2-jquery

Automatically exported from code.google.com/p/struts2-jquery
0 stars 0 forks source link

Dynamic Struts 2 input field generation #797

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
MY CODE :
$(document).ready(function(){

    $('#myLink').click(function(){

        $('#myDiv').append("<s:file label='File 1' name='fileUpload' size='40' />");

    });

});
---------------------------------------------------------------------
<div id="myDiv">

        </div>

        <a href="#" id="myLink">Change text</a>

-----------------------------------------------------------------
output must generate dynamic input fields with same name>>
-------------------------------------------------------------------
ERROR :-

Message: Unterminated string constant

Please give me the way to achieve this.

-----------------------------------------------------------------

Which struts2 version?
2.3

Which struts2-jquery plugin version?
7.1

Please provide any additional information below.
I want to get names for struts tag from Database and form the form like this

FORM :-

AD1---textfield        buttton to add more

AD2---textfield        buttton to add more

AD3---textfield        buttton to add more

AD1,AD2,AD3 all dynamically brought from DB.

AD1,AD2,AD3 --will have same name.
user can add by addmore button how can i generate dynamically using jquery.

Original issue reported on code.google.com by joseph.k...@gmail.com on 24 Mar 2012 at 9:21

GoogleCodeExporter commented 9 years ago
This is a JavaScript error struts will generate HTML for example: 
$('#myDiv').append("<input type="text" size="40"/>");
And this is wrong escaped or "Unterminated string" string :)

Can you try this:

$(document).ready(function(){

    $('#myLink').click(function(){

        $('#myDiv').append('<s:file label="File 1" name="fileUpload" size="40" />');

    });

});

Original comment by syt...@gmail.com on 28 Mar 2012 at 12:49

GoogleCodeExporter commented 9 years ago
This is not an Struts2 jQuery Issue. Please use the jquery Forums for this type 
of questions.

Original comment by johgep on 28 Mar 2012 at 1:41