cx3473359
asked on
Form field population from clipboard using a JavaScript
I have a single page which contains multiple forms. I would like the ability to populate certain fields in the different forms with data from the clipboard. Something like; <onclick="document.form1.f ield.value = document.form2.field.value = document.form3.field.value = clipboard data">. Onclick causes the clipboard value, which will be a 10 digit number, to be pasted into all of the fields specified.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The content area looses focus when you click the button and the paste action applies to the button and is lost. Work around is:
<DIV ID="oContent" contentEditable="true">
This is my area of testing text. You can edit this text. The paste button won't work though!
</DIV>
<Br>
<input type=button name=cut value="Cut" onClick="oContent.document .execComma nd('cut'); ">
<input type=button name=paste value="Paste" onClick="oContent.focus(); oContent.document.execComm and('paste ');">
</BODY>
</HTML>
<DIV ID="oContent" contentEditable="true">
This is my area of testing text. You can edit this text. The paste button won't work though!
</DIV>
<Br>
<input type=button name=cut value="Cut" onClick="oContent.document
<input type=button name=paste value="Paste" onClick="oContent.focus();
</BODY>
</HTML>
Oops wrong box, sorry ;)
ASKER
<INPUT TYPE="button" value="Paste Data" onClick="document.form1.fi