Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Adding innerHTML containing form
Message
From
18/10/2017 18:02:32
 
 
To
All
General information
Forum:
Javascript
Category:
DHTML
Title:
Adding innerHTML containing form
Miscellaneous
Thread ID:
01655077
Message ID:
01655077
Views:
44
I have a hit which transfers its content into the parent window into a div. Thus, I am using something like loDiv.innerHTML=HTMLCodeFromElsewhere. That HTML contains a form. The form appears ok on the page. However, when typing data into those fields, it is as is nothing was typed. A code like this would show blank values on input fields:
function Test()
{
   loElements=document.forms['Form1'].elements
   for (lnCounter=0; lnCounter<loElements.length; lnCounter++)
   {
      alert('Name: '+loElements[lnCounter].name+' ID: '+loElements[lnCounter].id+' Value: '+loElements[lnCounter].value)
   }
}
I have read somewhere that assigning HTML code to the innerHTML approach destroys the contents:

https://stackoverflow.com/questions/2192760/add-to-html-form-without-losing-current-form-input-information-in-javascript

However, in my case, the innerHTML I am passing is the HTML code for the full form. Is that approach supported?
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Next
Reply
Map
View

Click here to load this message in the networking platform