dcsimg
www.webdeveloper.com
Page 2 of 2 FirstFirst 12
Results 16 to 28 of 28

Thread: How to copy an entire form to clipboard?

  1. #16
    Join Date
    Nov 2006
    Posts
    528
    yes, you can ad multiple functin calls to an onclick evenet. But, it may not be the most efficient. For example, if validation fails you don't want to continue. So, it wouold make more sense to have one function, if it passes, to call the next function.

    I still don't understand why you are copying this to the clipboard. I thought you were using the form to post the data. Also, you could set up a global variable to set the fields and preferences for validation instead of passing all that data in the MM_ValidateForm function.

  2. #17
    Join Date
    Mar 2005
    Location
    Sydney, Australia
    Posts
    7,974
    You just include semi-colon separated Javascript statements in the onclick= or just stick them all in a function and call that from the onclick so as to have less Javascript cluttering your HTML.

  3. #18
    Join Date
    Aug 2006
    Posts
    119
    I dont want to open a new topic, so might you guys can answer my question about a clipboard.

    Is it possible to get the image from the clipboard using JS and paste it in the web page?

  4. #19
    Join Date
    Nov 2006
    Posts
    528
    Quote Originally Posted by sovik
    I dont want to open a new topic, so might you guys can answer my question about a clipboard.

    Is it possible to get the image from the clipboard using JS and paste it in the web page?
    Maybe I am totally missing something here. But, why do you want to copy data to the clipboard, only to copy it back from the clipboard. There has got to be a better solution. Where exactly are you wanting the information from your form to end up?

  5. #20
    Join Date
    Aug 2006
    Posts
    119
    mjdamato, I think you do miss understand something I just asked a question about a clipboard which has nothing to do with the main problemm. Probabbly it was a bad idea not to open a new thread.

  6. #21
    Join Date
    Jan 2007
    Posts
    14
    Quote Originally Posted by mjdamato
    yes, you can ad multiple functin calls to an onclick evenet. But, it may not be the most efficient. For example, if validation fails you don't want to continue. So, it wouold make more sense to have one function, if it passes, to call the next function.

    I still don't understand why you are copying this to the clipboard. I thought you were using the form to post the data. Also, you could set up a global variable to set the fields and preferences for validation instead of passing all that data in the MM_ValidateForm function.

    The only reason I am doing the clipboard thing is cause I need something that I can use starting Monday, then from there I am going to try and get it to post to another program. I only do it this way because I imagined it would be easier that way. but if I can get it to send the information to another program easier by say clicking in a text field in a ticket then going to my template and clicking send, then I'd go that way now instead, but I have no idea where to start on that...I do not program for a living, but I want to and I am so rusty I can hardly remember basic HTML from memory anymore.

    I just wish I could get all this wonderful code to work together, standa alone it works fine, but getting the clipboard function to work has been the bane of my existance!

    LOL
    Last edited by LostCode; 01-04-2007 at 03:33 PM.

  7. #22
    Join Date
    Jan 2007
    Posts
    14
    Quote Originally Posted by mjdamato
    yes, you can ad multiple functin calls to an onclick evenet. But, it may not be the most efficient. For example, if validation fails you don't want to continue. So, it wouold make more sense to have one function, if it passes, to call the next function.

    I still don't understand why you are copying this to the clipboard. I thought you were using the form to post the data. Also, you could set up a global variable to set the fields and preferences for validation instead of passing all that data in the MM_ValidateForm function.

    See, the simple things pass me like a supersonic jet lately

    I hadn't even considered creating a variable to carry all that extra crap...

  8. #23
    Join Date
    Jan 2007
    Posts
    14
    There has to be a way to copy to clip board in one bit of code. I cannot imagine that the creators of these programming languages haven't made anything like that.

    Okay, so I can get all this info into a text area, now, how do I get it into the clipboard? I thought of trying to add somethign like onChange="execCommand('Copy')" to the textarea, but apparently execCommand('Copy') is not a "default" function...*sigh*


    This is so frustrating...I am sorry to be such a pain.
    Last edited by LostCode; 01-04-2007 at 09:17 PM.

  9. #24
    Join Date
    Jan 2007
    Posts
    14

    It works!

    Check it out! Keep in mind, it only works in IE.

    Any ideas how I can make it so the copy function will not run if errors are returned? I was thinking of an if else statement, but I am wondering what you think?
    Attached Files Attached Files

  10. #25
    Join Date
    Mar 2007
    Posts
    1
    Quote Originally Posted by LostCode
    Check it out! Keep in mind, it only works in IE.

    Any ideas how I can make it so the copy function will not run if errors are returned? I was thinking of an if else statement, but I am wondering what you think?
    When write to new pape ? Please help me

  11. #26
    Join Date
    Jan 2007
    Posts
    14
    Quote Originally Posted by thanhvudng
    When write to new pape ? Please help me

    I am not sure I understand the question...

    I have attached the semi-completed version of my template tool. Still working on how to make it paste into a third party program.
    Attached Files Attached Files

  12. #27
    Join Date
    Jun 2013
    Posts
    2
    Quote Originally Posted by LostCode View Post
    I am not sure I understand the question...

    I have attached the semi-completed version of my template tool. Still working on how to make it paste into a third party program.
    Hi. I stumbled upon your code and am trying to use it for the same purpose of pasting the content on a logging software. below is the code that i created from your original code but it doesnt seem to work...please check on where i went wrong..thanks!

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>DTC Logging Tool</title>
    </head>

    <SCRIPT LANGUAGE="JavaScript">

    function updateDescription (frm)
    {
    var Template = ""

    Template += "Service Tag: " + frm.ServiceTag.value + "\r\n";
    Template += "System Type: " + frm.SystemType.value + "\r\n";
    Template += "OS: " + frm.OS.value + "\r\n";
    Template += "***DTC Entitled*** " ;
    Template += "DTC Order Number: " + frm.DTCOrderNumber.value + "\r\n";
    Template += "Issue: " + frm.Issue.value + "\r\n";
    Template += "Troubleshooting Steps: " + frm.TS.value + "\r\n";
    Template += "HFN Tool Used: " + frm.HFNTool.value + "\r\n";
    Template += "DC Session ID: " + frm.DCSessionID.value + "\r\n";
    Template += "Cobro: " + frm.Cobro.value + "\r\n";
    Template += "NTP: " + frm.NTP.value + "\r\n";
    Template += "Heatcheck: " + frm.Heatcheck.value + "\r\n";
    Template += "NonSat Reason: " + frm.NonSatReason.value + "\r\n";

    frm.holdtext.value = Template;
    Copied=frm.holdtext.createTextRange();
    Copied.execCommand('copy');
    alert('Information has been copied, right click and select paste or press ctrl+V to paste into Delta');


    }

    </SCRIPT>

    <body align=center>
    <form id="DesksideForm" name="DesksideForm" method="post" action="">

    <br>
    <table cellspacing="20" align="center"><tr><td valign="middle"></td>
    <td><font

    size="+2"><b>DTC Logging Tool</b></font></td><td></td></tr></table>
    <table align="center" cellpadding="0" cellspacing="0">
    <tr>
    <td valign="middle">Service Tag:</td>
    <td><input name="ServiceTag" type="text" id="ServiceTag" value="" size="30" /></td>
    </tr>
    <tr>
    <td valign="top">System Type:</td>
    <td><input name="SystemType" type="text" id="SystemType" size="30" /></td>
    </tr>
    <tr>
    <td valign="top">OS:</td>
    <td><input name="OS" type="text" id="OS" size="30" /></td>
    </tr>
    <tr>
    <td valign="top">***DTC Entitled***</td>
    <td>&nbsp;</td>
    </tr>
    <tr>
    <td valign="top">DTC Order Number:</td>
    <td><input name="DTCOrderNumber" type="text" id="DTCOrderNumber" size="30" /></td>
    </tr>
    <tr>
    <td valign="top">Issue:</td>
    <td><input name="Issue" type="text" id="Issue" size="30" /></td>
    </tr>
    <tr>
    <td width="332" valign="middle"><label id="TS">Troubleshooting Steps:</label></td>
    <td width="365"><textarea name="TS" cols="50" rows="4" wrap="virtual" id="TS"></textarea></td>
    </tr>
    <tr>
    <td valign="top">HFN Tool Used:</td>
    <td><label>
    <select name="HFNTool" size="1" id="HFNTool">
    <option value="" selected="selected"></option>
    <option value="YES">YES</option>
    <option value="NO">NO</option>
    </select>
    </label></td>
    </tr>
    <tr>
    <td valign="top">DC Session ID:</td>
    <td><input name="DCSessionID" type="text" id="DCSessionID" size="30" /></td>
    </tr>
    <tr>
    <td valign="top">Cobro:</td>
    <td><label>
    <select name="Cobro" size="1" id="Cobro">
    <option value="" selected="selected"></option>
    <option value="YES">YES</option>
    <option value="NO">NO</option>
    </select>
    </label></td>
    </tr>

    <tr>
    <td valign="top">NTP:</td>
    <td><input name="NTP" type="text" id="NTP" size="50" /></td>
    </tr>

    <tr>
    <td valign="top">Heatcheck:</td>
    <td><label>
    <select name="Heatcheck" size="1" id="Heatcheck">
    <option value="" selected="selected"></option>
    <option value="SAT">SAT</option>
    <option value="NonSAT">NonSat</option>
    </select>
    </label></td>
    </tr>
    <tr>
    <td width="332" valign="middle"><label id="NonSatReason">NonSat Reason:</label></td>
    <td width="365"><textarea name="NonSatReason" cols="50" rows="2" wrap="virtual" id="NonSatReason"></textarea></td>
    </tr>
    <tr>
    <td align="center" valign="middle"><label>
    <input type="reset" name="Reset" value="Clear Template" />
    </label></td>
    <td align="center" valign="middle"><input type="button" name="copyform" value="Complete" onclick="updateDescription(this.form)"/> </td>
    </tr>
    </table>
    <textarea name="holdtext" cols="100" rows="10" id="holdtext" style=visibility:hidden></textarea>
    </form>
    </body>
    </html>

  13. #28
    Join Date
    Jun 2013
    Posts
    14
    I think there is a much easier and better way to do this than using the clipboard.
    cool design

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles