[jQuery] Re: Request parameters from dynamically added html element are missing on the server side

2008-02-22 Thread chris


 Hi Charles,

 I'm afraid I can't provide you with a link... even though I really
want to provide it..

 I checked my code using 'Live HTTP Header' plugin, to see what are
parameters sent by browser.
I couldn't see those request  parameters sent to server side so I
think the problem is on the server side, not the server side.

But if I tried to create another html and jsp, imitating the code,
somehow it works. I can see the parameters were sent to the
script.

This is the code that works

script src=jquery.js type=text/javascript/script
script src=jquery.MultiFile.js type=text/javascript/script

form action=check.jsp method=post 

table
tr
tdbProfile on other portal/b/td
td
table
tr
tdPortal URL/td
tdProfile ID/td
td/td
/tr
tr
tdinput type=text 
name=portalurl0 id=portalurl0 / /
td
tdinput type=text 
name=profileid0 id=profileid0 //td
tdinput type=button value=Add 
onclick=addjquery() /
input type=button value=Profilvorlage / /td
input type=hidden name=counter 
value=1 id=counter /
/tr
/table
/td
/tr
tr
td/td
td
div id=profile

/div
/td
/tr
tr
td/td
tdinput type=submit value=apply /td
/tr

/table

/form

script type=text/javascript

function addjquery(){
var profileurl = document.getElementById(portalurl0).value;
var profileid  = document.getElementById(profileid0).value;
var id = document.getElementById(counter).value;
$(#profile).append(p id='row + id + '+profileurl
+nbsp;nbsp;+profileid+input type='hidden' name='profileurl[+id
+]'  value='+profileurl+' input type='hidden' name='profileid[+id
+]' value='+profileid+'nbsp;nbsp;a href='#'
onClick='removeFormField(\#row + id + \); return false;'Remove/
ap);

id = (id - 1 ) + 2;
document.getElementById(counter).value = id;
}

function removeFormField(id){
$(id).remove();
}


/script


 Any hint ? Thanks for your time.

 regards,
 Chris


On Feb 22, 7:06 am, polyrhythmic [EMAIL PROTECTED] wrote:
 Hello Chris,

 It will be difficult to debug this combination of code without an
 example page we can view.  Can you please provide us with a link?

 Charles



[jQuery] Re: Request parameters from dynamically added html element are missing on the server side

2008-02-21 Thread polyrhythmic

Hello Chris,

It will be difficult to debug this combination of code without an
example page we can view.  Can you please provide us with a link?

Charles

On Feb 21, 2:28 am, chris [EMAIL PROTECTED] wrote:
 Hi there,

 I tried to create input element dynamically using jQuery,  in form of
 text field and file upload.
 But somehow when I dumped all my request parameters on the server
 side, I never received these parameters even though I saw the the
 input elements were created on HTML form.
 Could someone give me a hint ?

 I use jsp and java on the server side, jQuery 1.1.4, and jQuery
 Multiple File Upload Plugin v1.26.

 This is the snippet of the code :

 script src=%= themeDisplay.getPathJavaScript() %/jquery/jquery.js
 type=text/javascript/script
 script src=%= themeDisplay.getPathJavaScript() %/geco/
 jquery.MultiFile.js type=text/javascript/script

 form action=blabla.jsp method=post enctype=multipart/form-data



 tr
 tdinput type=text 
 name=portlet:namespace /portalurl0
 id=portlet:namespace /portalurl0 / /td
 tdinput type=text 
 name=portlet:namespace /profileid0
 id=portlet:namespace /profileid0 //td
 tdinput type=button value=Add 
 onclick=portlet:namespace /addjquery() / input type=button 
 value=Profilvorlage / /td

 input type=hidden name=counter 
 value=1
 id=portlet:namespace /counter /
 /tr
 /table
 /td
 /tr
 tr
 td/td
 td
 div id=portlet:namespace /profile

 /div
 /td
 /tr
 tr
 tdbAttach CV/Resume/b/td
 tdinput type=file name=resumefile 
 id=portlet:namespace /my_file_element /

 /td
 /tr

 /form

 script type=text/javascript 
 $(document).ready(function(){
  $('#portlet:namespace /my_file_element').MultiFile({
   accept:'txt|doc|rtf', max:7, STRING: {
remove:'Remover',
selected:'Selecionado: $file',
denied:'Invalid file extension $ext!'
   }
  });});

 /script

 script type=text/javascript

 function portlet:namespace /addjquery(){
 var profileurl = document.getElementById(portlet:namespace 
 /portalurl0).value;

 var profileid  = document.getElementById(portlet:namespace 
 /profileid0).value;

 var id = document.getElementById(portlet:namespace 
 /counter).value;

 $(#portlet:namespace /profile).append(p id='portlet:namespace 
 /row + id + '+profileurl+nbsp;nbsp;+profileid+input

 type='hidden' name='profileurl[+id+]'  value='+profileurl+'input 
 type='hidden' name='profileid[+id+]' value='+profileid

 +'nbsp;nbsp;a href='#' onClick='portlet:namespace 
 /removeFormField(\#portlet:namespace /row + id + \); return

 false;'Remove/ap);

 id = (id - 1 ) + 2;
 document.getElementById(portlet:namespace /counter).value = id;

 }

 function portlet:namespace /removeFormField(id){
 $(id).remove();

 }

 /script