/    Sign up×
Community /Pin to ProfileBookmark

Copying values to clipboard

Hey all,

Is there a way to get the username checkbox in the code below to process the values from the top fields when create / copy is hit?

My setvalues function is definitly not working right.

I’ve been posting this all week, no one has even tried to help, other than constantly saying that clipboard functions don’t work in FF, which I’m well aware of. I’d like to paypal a reasonable amount – ($15-$20) to someone who helps me get it working, if that is Ok.

Thanks all.

[code]

<HTML>
<HEAD>
<style>
BODY {
MARGIN-TOP: 20px; FONT-SIZE: 11px; MARGIN-LEFT: 15px; COLOR: #333333; LINE-HEIGHT: 1.5; MARGIN-RIGHT: 15px; BACKGROUND-REPEAT: repeat-x; FONT-FAMILY: verdana, arial, helvetica, sans-serif; BACKGROUND-COLOR: #ffffff
}
</style>
<title>Copy to clipboard example</title>
<script type=”text/javascript”>

function enable() {
var clip = form.fn.value + ” called in: ID “”+ form.sn.value + “” needs unlocked for ” + form.tl.value + “. I enabled ” + form.fn.value + “‘s ” + form.tl.value + ” ID and verified login.”;
window.clipboardData.setData(‘Text’,clip);
}

function reset() {
var clip = form.fn.value + ” called in: ID “”+ form.sn.value + “” needs a password reset for ” + form.tl.value + ” login. I verified ID validation criteria, reset ” + form.fn.value + “‘s ” + form.tl.value + ” password and confirmed login.”;
window.clipboardData.setData(‘Text’,clip);
}

function setT(n){
document.getElementById(“cons”).value=n
}

function cnotes(){
var objects = document.getElementsByTagName(“input”);
var t=””;

for(var i=0;i<objects.length;i++)
{
if(objects[i].checked) t+=(objects[i].value+”nn”);
}

setT(t);
document.getElementById(“cons”).createTextRange().execCommand(“copy”);
}

function setvalues(“t”)
{
if (C1.checked)
{
“test1” + form.fn.value;
}
elseif (C2.checked)
{
“test2”;
}
elseif (C3.checked)
{
“test3”;
}
else (C4.checked)
{
“test4″;
}
}

</script>
</head><body>

<form name=”form”>
Admin clipboard<p>
Name:<br>
<input type=”text” name=”fn” size=”16″><br>
ID:<br>
<input type=”text” name=”sn” size=”16″><br>
Tool:<br>
<input type=”text” name=”tl” size=”16″>
</form>
<a href=”#” title=”Copy it” onClick=”enable()” onmouseover=”window.status=’Copy ID unlock text’; return true;”>
ID Unlock</a>&nbsp;|
<a href=”#” title=”Copy it” onClick=”reset()” onmouseover=”window.status=’Copy password reset text’; return true;”>
PW Reset</a>&nbsp;|
<a onclick=”form.reset(); clipboardData.clearData(); return false;” href=”#” onmouseover=”window.status=’Clear all forms and clipboard’; return true;”>
Clear All
</a>
</form>

<p>

<FORM name=”checks”>
<TABLE>
<TBODY>
<TR>
<TD><INPUT type=checkbox CHECKED name=C1 onclick=”setvalues(this);”> Test </TD></TR>
<TR>
<TD><INPUT type=checkbox name=C2 onclick=”setvalues(this);”> Why </TD>
<TD><INPUT type=checkbox name=C3 onclick=”setvalues(this);”> Wontyou </TD>
<TD><INPUT type=checkbox name=C4 onclick=”setvalues(this);”> work </TD></TR>
</TBODY></TABLE>
<P><TEXTAREA class=submit name=cons id=cons rows=20 cols=60></TEXTAREA></P><INPUT class=submit onclick=cnotes() type=button value=”Create / Copy”>&nbsp;&nbsp;&nbsp;<INPUT class=submit type=reset value=Reset name=B2>

<P><INPUT class=submit onclick=”parent.location=’mailto:linehad'” type=button value=Feedback>
</FORM></P>

</body>
</html>

[/code]

to post a comment
JavaScript

9 Comments(s)

Copy linkTweet thisAlerts:
@replicaApr 21.2006 — I'll give you a hand, for free, but it's a little unclear what you want the script to do.

Is there a way to get the username checkbox in the code below to process the values from the top fields when create / copy is hit?[/QUOTE]

process it in what way?

You can grab the values of anything on the page and do whatever to it with great ease. As for the clipboard not working in firefox you could use a hidden form value, and set the form method to 'GET' if javascript is all you can use. If you have access to php, asp, asp.net or something then you can POST the form and collect the hidden 'clipboard' value with that...

just need some clarification as to what you're trying to do.
Copy linkTweet thisAlerts:
@puredemoauthorApr 21.2006 — I should have said the "test" and "why" checkboxes instead of username.

Basically - if you type your firstname, a username and a tool in the top three fields, and then click the link, it will put a full sentance into your clipboard.

I would like the checkboxes to work the same way with taking the variables from the top fields and copying them below. It would be very similar to this code, but with the variable support added on.

<i>
</i>
&lt;HTML&gt;&lt;HEAD&gt;&lt;TITLE&gt;Cox Distros&lt;/TITLE&gt;
&lt;META http-equiv=Content-Type content="text/html; charset=windows-1252"&gt;
&lt;STYLE type=text/css&gt;BODY {
SCROLLBAR-FACE-COLOR: #ffffff; SCROLLBAR-HIGHLIGHT-COLOR: #ffffff; SCROLLBAR-SHADOW-COLOR: #ffffff;

SCROLLBAR-3DLIGHT-COLOR: #000000; SCROLLBAR-ARROW-COLOR: #000000; SCROLLBAR-TRACK-COLOR: #ffffff; SCROLLBAR-DARKSHADOW-COLOR:

#000000
}
P {
FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: tahoma
}
TD {
FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: tahoma
}
.input-box {
BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; BACKGROUND: white; BORDER-LEFT: black 1px solid; COLOR: blue;

BORDER-BOTTOM: black 1px solid
}
.submit {
BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-BOTTOM: black 1px solid;

FONT-FAMILY: tahoma
}
&lt;/STYLE&gt;


&lt;META content="MSHTML 6.00.2800.1515" name=GENERATOR&gt;&lt;/HEAD&gt;
&lt;BODY bgColor=#f5f5dc&gt;
&lt;SCRIPT language=javascript&gt;
function setT(n){
document.getElementById("cons").value=n
}


function cnotes(){
var objects = document.getElementsByTagName("input");
var t="";

for(var i=0;i&lt;objects.length;i++)
{
if(objects[i].checked) t+=(objects[i].value+"nn");
}


setT(t);
document.getElementById("cons").createTextRange().execCommand("copy");
}
&lt;/SCRIPT&gt;
&lt;/head&gt;




&lt;FORM&gt;
&lt;TABLE&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;INPUT type=checkbox CHECKED
value="fksdfvkdkfbfdkfbbf"
name=C1&gt; Username &lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;INPUT type=checkbox
value="fksdfvkdkfbfdkfbbffksdfvkdkfbfdkfbbf"
name=C3&gt; Cleveland &lt;/TD&gt;
&lt;TD&gt;&lt;INPUT type=checkbox
value="fksdfvkdkfbfdkfbbffksdfvkdkfbfdkfbbffksdfvkdkfbfdkfbbffksdfvkdkfbfdkfbbf"
name=C4&gt; Gainsville &lt;/TD&gt;
&lt;TD&gt;&lt;INPUT type=checkbox
value="fksdfvkdkfbfdkfbbffksdfvkdkfbfdkfbbffksdfvkdkfbfdkfbbffksdfvkdkfbfdkfbbffksdfvkdkfbfdkfbbf"
name=C2&gt; Hampton Roads &lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;INPUT type=checkbox
value="fksdfvkdkfbfdkfbbffksdfvkdkfbfdkfbbffksdfvkdkfbfdkfbbffksdfvkdkfbfdkfbbffksdfvkdkfbfdkfbbffksdfvkdkfbfdkfbbf"
name=C5&gt; Kanses &lt;/TD&gt;
&lt;TD&gt;&lt;INPUT type=checkbox


value="fksdfvkdkfbfdkfbbffksdfvkdkfbfdkfbbffksdfvkdkfbfdkfbbffksdfvkdkfbfdkfbbffksdfvkdkfbfdkfbbffksdfvkdkfbfdkfbbffksdfvkdkfbfdkf

bbf"
name=C6&gt; Las Vegas &lt;/TD&gt;
&lt;TD&gt;&lt;INPUT type=checkbox


value="fksdfvkdkfbfdkfbbffksdfvkdkfbfdkfbbffksdfvkdkfbfdkfbbffksdfvkdkfbfdkfbbffksdfvkdkfbfdkfbbffksdfvkdkfbfdkfbbffksdfvkdkfbfdkf

bbffksdfvkdkfbfdkfbbf"
name=C7&gt; Macon &lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;INPUT type=checkbox
value="asdfomgomg"
name=C8&gt; New England &lt;/TD&gt;
&lt;TD&gt;&lt;INPUT type=checkbox
value="asdfomgomgasdfomgomgasdfomgomg"
name=C9&gt; New Orleans &lt;/TD&gt;
&lt;TD&gt;&lt;INPUT type=checkbox
value="asdfomgomgasdfomgomgasdfomgomgasdfomgomgasdfomgomg"
name=C10&gt; Northern Virginia &lt;/TD&gt;&lt;/TR&gt;

&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P&gt;&lt;TEXTAREA class=submit name=cons rows=20 cols=60&gt;&lt;/TEXTAREA&gt;&lt;/P&gt;&lt;INPUT class=submit onclick=cnotes() type=button value="Create

/ Copy"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;INPUT class=submit type=reset value=Reset name=B2&gt;

&lt;P&gt;&lt;INPUT class=submit onclick="parent.location='mailto:[email protected]'" type=button value=Feedback&gt;
&lt;/FORM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;






The problem with this is. it just returns a set value. So I created that setvalues function so that there would be a function for the checkboxes to reference. Then someone told me that the setvalues function had to call the setT fucntion to write to the text box below.

so that is where

<i>
</i>
function setvalues("t")
{
if (C1.checked)
{
"test1" + form.fn.value;
}
elseif (C2.checked)
{
"test2";
}
elseif (C3.checked)
{
"test3";
}
else (C4.checked)
{
"test4";
}
}



Came from....
Copy linkTweet thisAlerts:
@puredemoauthorApr 21.2006 — Replica,

On my very first code, I hadn't realized that the links were not working for"ID unlock" and PW reset"

No wonder it was confusing.

Here is an example of code where they do work, when I was trying to to get the variables to return but not within the script tags ?

<i>
</i>
&lt;HTML&gt;
&lt;HEAD&gt;
&lt;style&gt;
BODY {
MARGIN-TOP: 20px; FONT-SIZE: 11px; MARGIN-LEFT: 15px; COLOR: #333333; LINE-HEIGHT: 1.5; MARGIN-RIGHT: 15px;

BACKGROUND-REPEAT: repeat-x; FONT-FAMILY: verdana, arial, helvetica, sans-serif; BACKGROUND-COLOR: #ffffff
}
&lt;/style&gt;
&lt;title&gt;Copy to clipboard example&lt;/title&gt;
&lt;script type="text/javascript"&gt;

function enable() {
var clip = form.fn.value + " called in: ID ""+ form.sn.value + "" needs unlocked for " + form.tl.value + ". I enabled " +

form.fn.value + "'s " + form.tl.value + " ID and verified login.";
window.clipboardData.setData('Text',clip);
}

function reset() {
var clip = form.fn.value + " called in: ID ""+ form.sn.value + "" needs a password reset for " + form.tl.value + " login. I

verified ID validation criteria, reset " + form.fn.value + "'s " + form.tl.value + " password and confirmed login.";
window.clipboardData.setData('Text',clip);
}

function setT(n){
document.getElementById("cons").value=n
}


function cnotes(){
var objects = document.getElementsByTagName("input");
var t="";

for(var i=0;i&lt;objects.length;i++)
{
if(objects[i].checked) t+=(objects[i].value+"nn");
}


setT(t);
document.getElementById("cons").createTextRange().execCommand("copy");
}

&lt;/script&gt;
&lt;/head&gt;&lt;body&gt;




&lt;form name="form"&gt;
Admin clipboard&lt;p&gt;
Name:&lt;br&gt;
&lt;input type="text" name="fn" size="16"&gt;&lt;br&gt;
ID:&lt;br&gt;
&lt;input type="text" name="sn" size="16"&gt;&lt;br&gt;
Tool:&lt;br&gt;
&lt;input type="text" name="tl" size="16"&gt;
&lt;/form&gt;
&lt;a href="#" title="Copy it" onClick="enable()" onmouseover="window.status='Copy ID unlock text'; return true;"&gt;
ID Unlock&lt;/a&gt;&amp;nbsp;|
&lt;a href="#" title="Copy it" onClick="reset()" onmouseover="window.status='Copy password reset text'; return true;"&gt;
PW Reset&lt;/a&gt;&amp;nbsp;|
&lt;a onclick="form.reset(); clipboardData.clearData(); return false;" href="#" onmouseover="window.status='Clear all forms and

clipboard'; return true;"&gt;
Clear All
&lt;/a&gt;
&lt;/form&gt;

&lt;p&gt;


&lt;FORM name="checks"&gt;
&lt;TABLE&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;INPUT type=checkbox CHECKED
value=form.fn.value + " called in: ID ""+ form.sn.value + "" needs unlocked for " + form.tl.value + ". I enabled " +

form.fn.value + "'s " + form.tl.value + " ID and verified login.";
name=C1&gt; Username &lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;INPUT type=checkbox
value=form.fn.value + " called in: ID ""+ form.sn.value + "" needs a password reset for " + form.tl.value + " login. I

verified ID validation criteria, reset " + form.fn.value + "'s " + form.tl.value + " password and co
name=C3&gt; Cleveland &lt;/TD&gt;



&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P&gt;&lt;TEXTAREA class=submit name=cons id=cons rows=20 cols=60&gt;&lt;/TEXTAREA&gt;&lt;/P&gt;&lt;INPUT class=submit onclick=cnotes() type=button

value="Create / Copy"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;INPUT class=submit type=reset value=Reset name=B2&gt;

&lt;P&gt;&lt;INPUT class=submit onclick="parent.location='mailto:linehad'" type=button value=Feedback&gt;
&lt;/FORM&gt;&lt;/P&gt;




&lt;/body&gt;
&lt;/html&gt;


Copy linkTweet thisAlerts:
@replicaApr 21.2006 — ok, I'm just forgetting about the clipboard functions for now.

This processes the state of the checkboxes whenever they're changed and updates what's in the textarea... hope this is going in the right direction. ?
[CODE]<HTML>
<HEAD>
<style>
BODY {
MARGIN-TOP: 20px; FONT-SIZE: 11px; MARGIN-LEFT: 15px; COLOR: #333333; LINE-HEIGHT: 1.5; MARGIN-RIGHT: 15px; BACKGROUND-REPEAT: repeat-x; FONT-FAMILY: verdana, arial, helvetica, sans-serif; BACKGROUND-COLOR: #ffffff
}
</style>
<title>Copy to clipboard example</title>
<script type="text/javascript">

function enable() {
var clip = form.fn.value + " called in: ID ""+ form.sn.value + "" needs unlocked for " + form.tl.value + ". I enabled " + form.fn.value + "'s " + form.tl.value + " ID and verified login.";
window.clipboardData.setData('Text',clip);
}

function reset() {
var clip = form.fn.value + " called in: ID ""+ form.sn.value + "" needs a password reset for " + form.tl.value + " login. I verified ID validation criteria, reset " + form.fn.value + "'s " + form.tl.value + " password and confirmed login.";
window.clipboardData.setData('Text',clip);
}

function setT( n )
{
document.getElementById('cons').value = n;
}

function cnotes()
{
var t = ''; //our string buffer

//find all the input elements and if they're a checked check box then append their value
var objects = document.getElementsByTagName('input');
for( var i = 0; i < objects.length; i++ )
{
if( objects[i].checked )
t += ( objects[i].value + "nn" );
}

setT( t ); //set the values of the combined input fields into the text area

//select the value in the textarea and copy it to the clipboard
document.getElementById('cons').createTextRange().execCommand('copy');
}

function setvalues( t )
{
var oCheckbox1 = document.getElementById('C1');
var oCheckbox2 = document.getElementById('C2');
var oCheckbox3 = document.getElementById('C3');
var oCheckbox4 = document.getElementById('C4');
var sBuffer = ''; //a string buffer

if ( oCheckbox1.checked )
sBuffer += document.getElementById('fn').value + 'rn';

if ( oCheckbox2.checked )
sBuffer += document.getElementById('sn').value + 'rn';

if( oCheckbox3.checked )
sBuffer += document.getElementById('tl').value + 'rn';

if( oCheckbox4.checked )
sBuffer += 'Checbox 4 is checked off' + 'rn';

setT( sBuffer ); //set the values of the combined input fields into the text area
}

</script>
</head>
<body>

<form name="form">
Admin clipboard<p>
Name:<br>
<input type="text" id='fn' name="fn" size="16"><br>
ID:<br>
<input type="text" id='sn' name="sn" size="16"><br>
Tool:<br>
<input type="text" id='tl' name="tl" size="16">
</form>
<a href="#" title="Copy it" onClick="enable()" onmouseover="window.status='Copy ID unlock text'; return true;">
ID Unlock</a>&nbsp;|
<a href="#" title="Copy it" onClick="reset()" onmouseover="window.status='Copy password reset text'; return true;">
PW Reset</a>&nbsp;|
<a onclick="form.reset(); clipboardData.clearData(); return false;" href="#" onmouseover="window.status='Clear all forms and clipboard'; return true;">
Clear All
</a>
</form>

<p>

<FORM name="checks">
<TABLE>
<TBODY>
<TR>
<TD colspan='3'><INPUT type=checkbox id='C1' CHECKED name=C1 onclick="setvalues(this);"> Test </TD>
</TR>
<TR>
<TD><INPUT type=checkbox id='C2' name=C2 onclick="setvalues(this);"> Why </TD>
<TD><INPUT type=checkbox id='C3' name=C3 onclick="setvalues(this);"> Wontyou </TD>
<TD><INPUT type=checkbox id='C4' name=C4 onclick="setvalues(this);"> work </TD>
</TR>
</TBODY>
</TABLE>
<P>
<TEXTAREA class=submit name=cons id=cons rows=20 cols=60></TEXTAREA></P><INPUT class=submit onclick=cnotes() type=button value="Create / Copy">&nbsp;&nbsp;&nbsp;<INPUT class=submit type=reset value=Reset name=B2>
<P>
<INPUT class=submit onclick="parent.location='mailto:linehad'" type=button value=Feedback>
</FORM>
</P>
</body>
</html>[/CODE]
Copy linkTweet thisAlerts:
@puredemoauthorApr 21.2006 — This is definitly in the right direction. I am going to work on this for a few minutes and will write back. Thank you.
Copy linkTweet thisAlerts:
@puredemoauthorApr 21.2006 — Check this out...

<i>
</i>
&lt;HTML&gt;
&lt;HEAD&gt;
&lt;style&gt;
BODY {
MARGIN-TOP: 20px; FONT-SIZE: 12px; MARGIN-LEFT: 15px; COLOR: #333333; LINE-HEIGHT: 1.5; MARGIN-RIGHT: 15px; BACKGROUND-REPEAT: repeat-x; FONT-FAMILY: verdana, arial, helvetica, sans-serif; BACKGROUND-COLOR: #ffffff
}
&lt;/style&gt;
&lt;title&gt;Copy to clipboard example&lt;/title&gt;
&lt;script type="text/javascript"&gt;


function setT( n )
{
document.getElementById('cons').value = n;
}

function cnotes()
{
var t = ''; //our string buffer

<i> </i>//find all the input elements and if they're a checked check box then append their value
<i> </i>var objects = document.getElementsByTagName('input');
<i> </i>for( var i = 0; i &lt; objects.length; i++ )
<i> </i>{
<i> </i> if( objects[i].checked )
<i> </i> t += ( objects[i].value + "nn" );
<i> </i>}

<i> </i>setT( t ); //set the values of the combined input fields into the text area

<i> </i>//select the value in the textarea and copy it to the clipboard
<i> </i>document.getElementById('cons').createTextRange().execCommand('copy');
}

function setvalues( t )
{
var c1 = document.getElementById('c1');
var c2 = document.getElementById('c2');
var c3 = document.getElementById('c3');
var c4 = document.getElementById('c4');
var sBuffer = ''; //a string buffer

<i> </i>if ( c1.checked )
<i> </i> sBuffer += form.fn.value + " called in: ID "" + form.sn.value + "" needs unlocked for " + form.tl.value + ". I enabled " + form.fn.value + "'s " + form.tl.value + " ID and verified login.";

<i> </i>if ( c2.checked )
<i> </i> sBuffer += form.fn.value + " called in: ID ""+ form.sn.value + "" needs a password reset for " + form.tl.value + " login. I verified ID validation criteria, reset " + form.fn.value + "'s " + form.tl.value + " password and confirmed login.";

<i> </i>if( c3.checked )
<i> </i> sBuffer += form.fn.value + " requests a Lotus ID redistribution for " + form.sn.value + ". I sent this for approval to " + form.fn.value + "'s manager";

<i> </i>if( c4.checked )
<i> </i> sBuffer += form.fn.value + " reports that " + form.tl.value + " is giving an error --&gt; """;

<i> </i>setT( sBuffer ); //set the values of the combined input fields into the text area
}

&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;

&lt;form name="form"&gt;
Name:&lt;br&gt;
&lt;input type="text" id='fn' name="fn" size="16"&gt;&lt;br&gt;
ID:&lt;br&gt;
&lt;input type="text" id='sn' name="sn" size="16"&gt;&lt;br&gt;
Tool:&lt;br&gt;
&lt;input type="text" id='tl' name="tl" size="16"&gt;
&lt;/form&gt;

<i> </i>&lt;a onclick="form.reset(); clipboardData.clearData(); return false;" href="#" onmouseover="window.status='Clear all forms and clipboard'; return true;"&gt;
<i> </i>Clear Form
<i> </i>&lt;/a&gt;
&lt;/form&gt;

&lt;p&gt;

&lt;FORM name="checks"&gt;
&lt;INPUT type=checkbox id='c1' name=c1 onclick="setvalues(this);"&gt;ID Unlock&lt;br&gt;
&lt;INPUT type=checkbox id='c2' name=c2 onclick="setvalues(this);"&gt;Password Reset&lt;br&gt;
&lt;INPUT type=checkbox id='c3' name=c3 onclick="setvalues(this);"&gt;Lotus ID Redistribution&lt;br&gt;
&lt;INPUT type=checkbox id='c4' name=c4 onclick="setvalues(this);"&gt;Tool error&lt;br&gt;

<i> </i>&lt;P&gt;
<i> </i>&lt;TEXTAREA class=submit name=cons id=cons rows=20 cols=60&gt;&lt;/TEXTAREA&gt;&lt;/P&gt;&lt;INPUT class=submit onclick=cnotes() type=button value="Create / Copy"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;INPUT class=submit type=reset value=Reset name=B2&gt;
<i> </i>&lt;P&gt;
<i> </i>&lt;INPUT class=submit onclick="parent.location='mailto:linehad'" type=button value=Feedback&gt;
&lt;/FORM&gt;
&lt;/P&gt;
&lt;/body&gt;
&lt;/html&gt;




Need to make the "create / copy" button work - not sure where it is getting the "on" stuff.
Copy linkTweet thisAlerts:
@puredemoauthorApr 21.2006 — <i>
</i>
<i> </i>{
<i> </i> if( objects[i].checked )
<i> </i> t += ( objects[i].value + "nn" );
<i> </i>}




This used to work when the checkboxes had values.. now they just call functions ?
Copy linkTweet thisAlerts:
@replicaApr 21.2006 — ? right. Cause the checkboxes aren't associated with the text fields...

Why not just use the setvalues() function for the onclick of the create / copy button? that t argument could be a boolean to set it to the clipboard or not... something like
[CODE]<HTML>
<HEAD>
<style>
BODY {
MARGIN-TOP: 20px; FONT-SIZE: 12px; MARGIN-LEFT: 15px; COLOR: #333333; LINE-HEIGHT: 1.5; MARGIN-RIGHT: 15px; BACKGROUND-REPEAT: repeat-x; FONT-FAMILY: verdana, arial, helvetica, sans-serif; BACKGROUND-COLOR: #ffffff
}
</style>
<title>Copy to clipboard example</title>
<script type="text/javascript">


function setT( n )
{
document.getElementById('cons').value = n;
}

function cnotes()
{
var t = ''; //our string buffer

//find all the input elements and if they're a checked check box then append their value
var objects = document.getElementsByTagName('input');
for( var i = 0; i < objects.length; i++ )
{
if( objects[i].checked )
t += ( objects[i].value + "nn" );
}

setT( t ); //set the values of the combined input fields into the text area

//select the value in the textarea and copy it to the clipboard
document.getElementById('cons').createTextRange().execCommand('copy');
}

function setvalues( setToClipboard )
{
var c1 = document.getElementById('c1');
var c2 = document.getElementById('c2');
var c3 = document.getElementById('c3');
var c4 = document.getElementById('c4');
var sBuffer = ''; //a string buffer

if ( c1.checked )
sBuffer += form.fn.value + " called in: ID "" + form.sn.value + "" needs unlocked for " + form.tl.value + ". I enabled " + form.fn.value + "'s " + form.tl.value + " ID and verified login.";

if ( c2.checked )
sBuffer += form.fn.value + " called in: ID ""+ form.sn.value + "" needs a password reset for " + form.tl.value + " login. I verified ID validation criteria, reset " + form.fn.value + "'s " + form.tl.value + " password and confirmed login.";

if( c3.checked )
sBuffer += form.fn.value + " requests a Lotus ID redistribution for " + form.sn.value + ". I sent this for approval to " + form.fn.value + "'s manager";

if( c4.checked )
sBuffer += form.fn.value + " reports that " + form.tl.value + " is giving an error --> """;

setT( sBuffer ); //set the values of the combined input fields into the text area

if( setToClipboard )
{
//select the value in the textarea and copy it to the clipboard
document.getElementById('cons').createTextRange().execCommand('copy');
}
}

</script>
</head>
<body>

<form name="form">
Name:<br>
<input type="text" id='fn' name="fn" size="16"><br>
ID:<br>
<input type="text" id='sn' name="sn" size="16"><br>
Tool:<br>
<input type="text" id='tl' name="tl" size="16">
</form>

<a onclick="form.reset(); clipboardData.clearData(); return false;" href="#" onmouseover="window.status='Clear all forms and clipboard'; return true;">
Clear Form
</a>
</form>

<p>

<FORM name="checks">
<INPUT type=checkbox id='c1' name=c1 onclick="setvalues();">ID Unlock<br>
<INPUT type=checkbox id='c2' name=c2 onclick="setvalues();">Password Reset<br>
<INPUT type=checkbox id='c3' name=c3 onclick="setvalues();">Lotus ID Redistribution<br>
<INPUT type=checkbox id='c4' name=c4 onclick="setvalues();">Tool error<br>

<P>
<TEXTAREA class=submit name=cons id=cons rows=20 cols=60></TEXTAREA></P><INPUT class=submit onclick='setvalues(true)' type=button value="Create / Copy">&nbsp;&nbsp;&nbsp;<INPUT class=submit type=reset value=Reset name=B2>
<P>
<INPUT class=submit onclick="parent.location='mailto:linehad'" type=button value=Feedback>
</FORM>
</P>
</body>
</html>[/CODE]


I didn't test that or anything. I gotta run off to a meeting right away but I'd like to not that that setting to clipboard thing _should_ be changed to something that will work in mozilla browsers.

Hope it helps.
Copy linkTweet thisAlerts:
@felgallApr 21.2006 — 
  • 1. Get the code working without the clipboard function.


  • 2. Add the following function to your code


  • function sendToClipboard(s) {
    if( window.clipboardData &amp;&amp; clipboardData.setData )
    clipboardData.setData("Text", s);
    }


  • 3. Add to your Javascript code to grab all of the text etc that you want from the various visible fields and create the content that you want to write to the clipboard and call sendToClipboard() with that content.


  • Regular web browsers will then be able to work properly without giving an error through not being able to access the clipboard wile IE users with security levels set too low will have the value copied to their clipboard.
    ×

    Success!

    Help @puredemo spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.23,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...