Jump to content

Copy Data From One Field To Another


Recommended Posts

Hi, I am trying to implement the following function into a details datapage:

 

Text Box 1 - user types in data

 

Text Box 2 - user clicks button and Text Box 1 data is copied into Text Box 2

 

I have found javascript that makes this work with a checkbox, but I would like a button. I found javascript for a button but it doesn't seem to work within the datapage for some reason. Here is the button javascript I found. One problem is that the button html below trys to submit the page.

 

<script>
function onSubmitClick() {
var box1 = document.getElementById('box1');
var box2 = document.getElementById('box2');
box2.value = box1.value;
}
</script>

<textarea id='box1'></textarea>
<textarea id='box2'></textarea>
<button onclick='onSubmitClick(); return false'>Click Me</button>

Link to comment
Share on other sites

I got it to work. For some reason I only get the problem if I test the code through Chrome html editor. When I actually deploy the datapage it works. Thanks for the help.

 

One more question, I have datapage#1 with an iframe that contains datapage#2. I would like a button on datapage#1 that copies a field from datapage#2 and pastes the data within a field on datapage#1, ie., the exact same thing as the above code only across the iframe barrier. Do you know how to tweak the above code to accomplish such a function?

Thanks again, I appreciate your help!

Link to comment
Share on other sites

  • 8 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...