I've got an PDF document with 2 editable text fields: "surname" and "email".
Now the Email ALWAYS consists of this format: Name.Surname#email.com . So I can simply copy the email and I already have got the data I need in the memory/clipboard.
Now I need JavaScript to do 2 things:
1) Copy the email into the "email" field on Open-Document event.
2) Parse the Name.Surname#email.com and only copy the Surname into the "surname" text field
Before the PDF document is opened, the Name.Surname#mail.com already has been copied to the memory. Now when I open the PDF document, I want both things 1) 2) done.
How do I go about this please?
Create onchange handler and parse input data by regexp. Then manually update fields.
Related
I have this script code in a current page I'm working on - it returns the HTML for the document. The alert was just debug to see if this code was running. The current HTML it returns is only the last part of the document, but at least it returns something...
<script type="text/javascript">
function getHtml() {
var html_source = document.createElement("INPUT");
html_source.type = "hidden";
html_source.name = "html_source";
html_source.value = document.documentElement.outerHTML;
document.forms[0].appendChild(html_source);
alert('getHtml(): completed...');
}
</script>
What I need this code to actually do is return the entire page as the HTML string (this page has lots of text fields and other controls), and I need the HTML to actually be marked up with all field data that is currently filled out on the form. I think this would mean that the value fields for all text inputs would be modified to contain what the control currently contains, returning the HTML as a string like above.
Does anyone have code that will do this? The reason I need the HTML like that with all fields filled out is so I can convert the HTML form to a PDF document that already has input field data entered, as if the form was already filled out.
The above script will return the HTML, but if I add data to some of the fields in that section of the HTML document, that data isn't evident in the string that code returns. I need that code to return all the data as well, associated with each field.
I hope this makes sense; basically I'm trying capture to a 100% an HTML document as a string that was already filled out by a user, at the time they click Submit. Once I have that string, I can do whatever I want with it including send it to another browser instance where it would be rendered as already filled out, or more to the point for me, to a PDF file renderer, converting the HTML form into a PDF file that is already filled out.
Good afternoon,
I have an excel vba being run when a button is clicked to print to PDF. the script then opens the PDF, add's two signature boxes and two form fields (text).
My two part question is
how do i format the PDF form field i created to a date form field? The VBA that creates the PDF text field is as follows.
coords = Array(thlft + 311, thtop - 26, thrt + 242, thebot)
Set formField = JSO.addField("sca_date", "text", 0, coords) '0 = 1st page
formField.textSize = 6
formField.textFont = "Arial"
formField.StrokeColor = JSO.Color.transparent```
I've examined Adobe's JavaScript™ for Acrobat® API Reference. There are references for creationdate and modified date - but not that I could find to format a text field as a date or just put in a date field.
Is it possible to add javascript to the signature fields? What I mean is right now I can manually open that newly created PDF, click on properties for one of the signature boxes - click signed tab. Then select "this script executes when field is signed". Then I put in some js that will enter the date in the date field when signed. and email the PDF out. What I'd rather do is when I click print to PDF - it puts that javascript into the PDF document for me? I hope that makes sense. I realize I can enter a date into the field with VBA but the date of when the form will be signed is not yet known.
For this one I just couldn't find anything. Mostly the results pertain to coding javascript with VBA but not embedding JS with VBA.
Based on the addField documentation,there appears to be no "date"-type form field available - any date field is just a "text"-type field like the one you already have.
look at the "setAction" method for adding script handlers
https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/AcrobatDC_js_api_reference.pdf
Maybe also relevant: https://community.adobe.com/t5/acrobat/can-acrobat-auto-populate-a-date-field-upon-digital-signature-of-a-form/td-p/4524073?page=1
In my rails application I have a form where I am showing password field and on jquery ajax success callback I am updating the value inside the password field.
Example :
$("#some-field").val('password-value');
After doing this, field is updated with the password and I see masked password in the password field.
Now My Requirement is I need to copy this masked password value and have to use it in some other browser window and need to paste in some other website's password field.
So I am searching for a good way to achieve this.
Till now I got many jquery plugins which are masking the value for normal input text field using mask(), but the problem I am facing is copying of masked value and mainly value should get copied properly when used in some other places.
Can any one has any idea on this..
Thanks you in advance
Dean
You can put in an invisible input, in localStorage, in a javascript variable encoded send to server with ajax and decode there. than do what you want with it. I hope I understood well what you asked.
I think This is what You want:
function copyToClipboard (text) {
window.prompt ("Copy to clipboard: Ctrl+C, Enter", text);
}
function displayResult()
{
var x=document.getElementById("password").value;
copyToClipboard(x);
}
displayResult();;
I'd like to be able to replace a standard HTML <TEXTAREA> input with insertable <INPUT> text inputs. By insertable, I mean having two TEXT form inputs (name, role) and an "Add" button after it to add a new name/role after this one if desired.
Ideally I'd have 'role' in an HTML <SELECT> input (drawn from my database) but I'm not really asking about that now :)
Also (again ideally) I'd like to be able to read these value in and parse them to look the same as when they were entered, i.e. with the text fields and pulldowns.
My database stores all of this in a single MySql 'text' which right now I have to enter manually in the format :
name - role ; name2 - role2 ; name3 - role3
and my script (that creates XML from this) explodes the "name" into two nodes explode'd by a "space-dash-space" and separates each node when it reads a semicolon.
Edited to show that my main problem is how to replace the plain HTML <textarea> with one or more <INPUT> fields and serialize them so they can be stored in my MySQL text record.
You can save the data as serialized php or JSON encoded string. That way, you can keep the object structure in the TEXT field.
Hope that helps.
Here was my solution: to use jQuery's replaceWith, replacing the TEXTAREA's tag with a bunch of <INPUT TYPE=TEXT name=myVar[]> so that they were stored in an array, and implode/explode the values as I needed them.
I'm telling the view to display a field with the NID contents. I'm telling it that I wish to "Rewrite the output of this field" and I enter:
<a href=”javascript:void(0);” onclick="javascript: approve([nid])" >Approve</a>
When viewing the page, all the javascript has been stripped. How do I get views to accept javascript in the link, or what other way can I use to display a link?
Note: Custom Text field doesn't work either.
Found the solution! http://drupal.org/project/views_customfield
From the description:
This module provides some useful (views)fields.
Available (views)fields:
Markup
Field that allows usage of custom text and the input filter system.
PHP code
Field that allows usage of custom PHP code (with access to view's database result)
Rownumber
Field containing rownumber (respects pagers).