473,797 Members | 2,933 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

copying entire form objects to another form??

Hello,
When there a two forms like the follosings,

<form name="source">
<input name="a..." value=".." ..>
<input name="a..." value=".." ..>
<input name="a..." value=".." ..>
<input name="a..." value=".." ..>
</form>

<form name="target" />

As you see target form has no child elements and source form has *a lot*
of elements.
Is this possbile to copy entire objects of source form to target form?
(I don't mean copying filed by field)

Regards,
KwonNam.
Jan 11 '06 #1
3 1645
Son KwonNam wrote:
Hello,
When there a two forms like the follosings,

<form name="source">
<input name="a..." value=".." ..>
<input name="a..." value=".." ..>
<input name="a..." value=".." ..>
<input name="a..." value=".." ..>
</form>

<form name="target" />

As you see target form has no child elements and source form has *a lot*
of elements.
To be valid, your form must contain at least one block or script element
and have an action attribute. It must also have a closing tag, your
markup seems to infer an empty XHTML element.

<form name="target" action=""><p></p></form>

<URL:http://www.w3.org/TR/html4/interact/forms.html#edef-FORM>
Forms /should/ use an ID attribute rather than a name, but I guess name
is far more convenient for what you are attempting.

Is this possbile to copy entire objects of source form to target form?
(I don't mean copying filed by field)

function cloneForm(srcNa me, tgtName)
{
var srcForm = document.forms[srcName];
var tgtForm = document.forms[tgtName];

if (tgtForm && srcForm && srcForm.cloneNo de) {
var cpyForm = srcForm.cloneNo de(true);
cpyForm.name = tgtForm.name;

// Change any ID attributes that were copied to
// the clone before adding it to the document

tgtForm.parentN ode.replaceChil d(cpyForm, tgtForm);
}
}
Call it with:

cloneForm('sour ce', 'target');

--
Rob
Jan 11 '06 #2
Son KwonNam wrote on 11 jan 2006 in comp.lang.javas cript:
When there a two forms like the follosings,

<form name="source">
<input name="a..." value=".." ..>
<input name="a..." value=".." ..>
<input name="a..." value=".." ..>
<input name="a..." value=".." ..>
</form>

<form name="target" />

As you see target form has no child elements and source form has *a
lot* of elements.
Is this possbile to copy entire objects of source form to target form?
(I don't mean copying filed by field)


<div id='container1' >
Here:
<form name="mySource" >
<input name="a" value=".." ><br>
<input name="b" value=".." ><br>
<input name="c" value=".." ><br>
<input name="d" value=".." >
</form>
</div>

<div id='container2' >

</div>

<script type="text/JavaScript">

var c1 = document.getEle mentById('conta iner1')
var c2 = document.getEle mentById('conta iner2')
c2.innerHTML = c1.innerHTML.re place('mySource ','myTarget')

</script>

This does not work if you delete the text "Here:".

Why ????
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jan 11 '06 #3
Evertjan. wrote:
[...]
<div id='container1' >
Here:
<form name="mySource" >
<input name="a" value=".." ><br>
<input name="b" value=".." ><br>
<input name="c" value=".." ><br>
<input name="d" value=".." >
</form>
</div>

<div id='container2' >

</div>

<script type="text/JavaScript">

var c1 = document.getEle mentById('conta iner1')
var c2 = document.getEle mentById('conta iner2')
c2.innerHTML = c1.innerHTML.re place('mySource ','myTarget')

</script>

This does not work if you delete the text "Here:".

Why ????


Dunno, it works fine regardless in Safari, Firefox and IE 5.2 on Mac.
--
Rob
Jan 11 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3657
by: Robert Tarantino | last post by:
Hello, I am trying to find a way to create a scheduled task or service that will copy my local profile folders under "Documents and settings" to a network drive. This would allow me to restore my settings if my profile became tampered with or corrupt. Is there any sample code available out there? -Robert
9
1535
by: Raposa Velha | last post by:
Any of you ever catch this bug: I made a form and decided to copy it. Then I modified the cloned form. Then I run it and access start saying "Error accessing file. Network connection may have been lost." Then I tryed to modify an event procedure and I realized that the correspondig code wasn't copyed along with the form! Deleting the form didn't solve the problem and a Compact and Repair Database did everything but reparing it! Actually I'm...
6
2566
by: solex | last post by:
Hello, I am trying to use serialization to copy objects. The object in question "Institution" inherits from a parent object "Party" both are marked as <Serializable()>. Initially I can copy an empty Institution to another empty Institution, using the following routine: Private Sub CopyObject(ByRef FromObject As Object, ByRef ToObject As Object) Dim m As New MemoryStream Dim b As New BinaryFormatter
4
1469
by: Robert Tarantino | last post by:
Hello, I am trying to find a way to create a scheduled task or service that will copy my local profile folders under "Documents and settings" to a network drive. This would allow me to restore my settings if my profile became tampered with or corrupt. Is there any sample code available out there? -Robert
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9536
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10245
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10205
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10021
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9063
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4131
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2933
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.