[Javascript] Adding more HTML to DIV with form

Peter Brunone peter at brunone.com
Tue Jun 13 11:18:47 CDT 2006


		Hi Peter,

   The file input is a tricky beast, mostly because of security concerns.  You can't paste or otherwise add any information to a file element with Javascript; that would leave too much opportunity for malicious code.  I think in this case, you're going to have to keep that control in a different element so you aren't pulling it out and adding it again.

Cheers,

Peter

				From: "Peter Lauri" lists at dwsasia.com

Hi,

I have a script that adds HTML to a specific DIV with a specific ID:

function add_morefile() {
var x = document.getElementById('attach_file');
x.innerHTML += '

for="author">Attachment file: 	 
name="doc_attach[]" id="doc_attach" type="file" class="typefile"
/>	 File Name:

type="text" />	 File created
by: 	 
id="doc_filename_author" type="text" />	 

';
}

If the user has filled in information in the form already, all information
is still there except in the  object. Why is that?

If I want to add more form fields, should I use an other function to keep
the  value?

Best regards,
Peter Lauri
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20060613/f0d62a0b/attachment.htm>


More information about the Javascript mailing list