This is hopefully a simple one.... but i have not figured it out after a few hours so any help would be great
i want to take rawValues from text fields and use them in various places
FirstName.rawvalue = "steve" and Surname.rawValue = "Brown"
I want to be able to use FirstName and Surname with other text as either forced Caps or forced sentence case or whatever
A working example being,
"This book is owned by " + Firstname.rawValue (++somehow caps++) + Surname.rawValue (++somehow caps++) +" please return if found"
This book is owned by STEVE BROWN please return if found
But also to be able to use those values to produce "Steve Brown" elsewhere
*****.toUpperCase(); // gives whole string in Upper Case
*****..substr(0,1).toUpperCase()+""+*****..substr(1);//gives first character to upper case then add rest of the string.
Please find the attached sample.
One quick question, how would you change the code you have so that the output Uppercase and Sentence, instead of being put into text fields are stored as variables so that they can be reused all over the place
i tried changing it like
var uC = this.rawValue;
uC.toUpperCase() = var NameUpper;
uC.substr(0,1).toUpperCase()+""+uC.substr(1) = NameSentence;
but that broke it, and also i tried defining the variables above tat level, so var Nameupper = firstnameupper.rawvalue but that breaks when the field firstnameupper is removed.
any suggestions would be much appeciated
In sample i just place to one text field.
In ur case make those as functions, where ever need just call that functions so it will return the required format.
Check the attached sample. These functions under script variables named as js. Also first text field exit event i am calling those functions.
I tried to reproduce (learn by copying) what you did, so i did this form
(attached) but something is wrong, i think with how i did the variables
any idea what i did wrong, i clicked file, form properties named it js and
added the script - but it looks different in the heirachy for some reason
thanks so much for the help
that's really weird,
i'm clicking file, form properties, variables - hitting the green +, adding name, say "dog" adding value, say "woof"
but that does not go into heirachy right.... cant be accessed... i added your code (thanks for it) like that, and it does not stick..... really confused
That is the way to create script variable which can be access any where in the pdf.
But here we are creating script object.
right click on variables on hirachy tab then click on insert script object and re-name the script object to js. copy the code to top window when selected the new created object, it will solve ur problem.
I was wondering if it is posible to extend the script to set each first character of a word to upper case and the rest to lower case, if there are several words in the field
i.e. ”james brown” will be set to ”James Brown”
and “JAMES BROWN” wil be set to”James Brown”
I tried this:
But this only sets the first character to upper case and the rest of the field to lower case. How do I acces the next word?
Europe, Middle East and Africa