Hello!
Reading around I found out it is possible to create macros in LC Designer and placing them under the Tools menu (http://blogs.adobe.com/formfeed/2010/01/designer_es2_macros.html).
However, what I need is something hopefuly simpler: I need a script to find and replace certain characters in the form text, such as replacing % with ç, globaly.
Where do I find simple examples of how to do this?
Thank you for any ideas!
Marcos
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
the macro doesn't touch any tooltips right now as they are not stored in "value" nodes.
As I mentioned you should not use any special characters (means all characters that are not used in the US) in the whole macro.
So if you try to replace all ç use var RegEx = /\u00E7/gm.
Views
Replies
Total Likes
Do you want do replace the characters during runtime (Acrobat/Reader) or at design time (Designer)?
Macros are only usable at design time.
They can do a lot a things, but it you need to develop them yourself.
To replace special characters and string you also can switch to the xml source and press ctrl+H.
During runtime you can use scripts with regular expressions to replace strings etc.
Views
Replies
Total Likes
Hello Radzmar!
Thank you very much for your reply!
Actually I need this done at design time. Yes, I know I will have to develop it myself, I'm just a bit lost as to where to start.
Reason for all this: client upgraded 2,400 forms from old times JetForms and a great number of Portuguese special characters did not translate correctly, the result is a mess.
We have even contacted Adobe Support but they did not find a solution for this problem.
So I was left with the task of correcting this... The initial approach was to save the forms as XDP and apply the corrections using a script we did in Acrobat. It works, but it turned down that when we save as XDP the checkboxes and radio buttons are all messed up!
A very alternative way was to do some copy and pasting, using the original XML code - it works, but the client is not happy with so much work for 2,400 forms...
So I thought about creating a macro in LiveCycle Designer. I implemented the sample from the URL I mentioned above, but that's not what I need and I do not have (yet) enough knowledge of scripting in this environment to create my own.
Thank you!
Best Regards,
Marcos
Views
Replies
Total Likes
Ok,
where are those characters in your forms?
In static texts or in captions or field values etc.
Can you share one of the forms, so I can check how to fix it with a macro?
Views
Replies
Total Likes
Hello Radzmar!
Thank you very much!
The characters are in static texts, captions, etc. Curiously enough, they translate correctly in tooltips.
Yes, of course I can share a sample. Where do I send it to, please? I did not see any attachment option in this forum.
Thank you!!
Marcos
Views
Replies
Total Likes
Hi,
here's a macro for your task.
It looks for all nodes with a "value" class and replaces all % with ç.
This solution is hard coded, so if you need more to replace other characters you have to change the regular expression and the replace function.
Pay attention with special characters (umlauts etc.) in the macro, they can cause the script to fail.
For example: .replace(RegEx, "ç"); doesn't work.
Use the unicode notation instead, then it generally works.
Views
Replies
Total Likes
Hi Radzmar!
Thank you so much for your script! I've tested and it works great.
Now, I still have some questions...
1. If the character to be replaced is, say, a "ç", must I use the unicode equivalent in the regular expression?
2. Curiously enough, special characters located inside the <tooltip></tooltip> tags are translated correctly and should not be touched by the scrtpt. How do I test for these tags to leave them unchanged?
Thank you again!
Marcos
Views
Replies
Total Likes
Hi,
the macro doesn't touch any tooltips right now as they are not stored in "value" nodes.
As I mentioned you should not use any special characters (means all characters that are not used in the US) in the whole macro.
So if you try to replace all ç use var RegEx = /\u00E7/gm.
Views
Replies
Total Likes
Hi Radzmar!
Great!
I think this will solve the issue.
Now, something strange is happening - the script was working just fine until yesterday...
Now, when I try to run it, I get this error message:
"Error: Invalid property get operation; line doesn't have property 'value'"
Any idea of why this is happening?
Thank you very much once again!
Marcos
Views
Replies
Total Likes
How does you script looks like?
Have you done any changes to it? The error indicates that you trying to change the value property of a line object, which generally doesn't have that property.
Views
Replies
Total Likes
No, I haven't changed your script!
I just tried to run it to correct one of the client's forms.
It still works if I create a new blank form, create a field and run the script.
Marcos
Views
Replies
Total Likes
Ok,
if found the reason.
We have to exclude some classNames which cannot be changed.
Views
Replies
Total Likes
Thank you again! :)
But we still have problems...
Runs ok with a new blank form with one field.
With one of the client's forms, brings up the error message:
"Error: oldValue.replace is not a function".
Marcos
Views
Replies
Total Likes
Ok,
I see the problem.
This happens when the returned value is null.
Next try:
Aha!
Now it's working beautifully.
Thank you very much!!!
All the best!
Marcos
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies