#1
|
|||
|
|||
![]()
I'm having trouble writing a rule to change the color of the "@" symbol to black while keeping the rest of the email address red. When I validate the rule it returns my field correctly but it is not changing the color when I preview it. I have checked and I labeled the color exactly how it is spelt in my loaded colors and I have "treat returned strings as tagged text" selected. What am I missing? Thanks!
Code:
return Field("Email").replace(/@/g, '<color name="Black">@</color>'); Last edited by hkenney; February 12th, 2016 at 07:43 AM.. |
#2
|
|||
|
|||
![]() Quote:
You could also try escaping the ampersand, but I don't think it is necessary. This works for me as well. Code:
return Field("Email").replace(/\@/gi, '<color name="black">@</color>');
__________________
David Miller FusionPro VDP Creator 12.0.3 Adobe Acrobat Pro 2021 macOS Big Sur 11.6.2 Last edited by David Miller; February 12th, 2016 at 08:13 AM.. |
#3
|
|||
|
|||
![]()
Thanks for looking into this David! Yes I am inserting the rule into the text field. I have been trying and trying and nothing is working. Could it be because the red color in the rest of the string is a spot color? I can't see why that would matter but I'm trying to think of anything!
Thanks, Hilary |
#4
|
|||
|
|||
![]()
It is working for me regardless of spot or process. Maybe you could collect and upload your template?
__________________
David Miller FusionPro VDP Creator 12.0.3 Adobe Acrobat Pro 2021 macOS Big Sur 11.6.2 |
#5
|
||||
|
||||
![]() Quote:
Code:
return "Yep, I'm the Email rule!"; Code:
return Field("Email").replace('@','<span color="Black">@</span>');
__________________
Ste Pennell FusionPro VDP Creator 9.3.15 Adobe Acrobat X 10.1.1 Mac OS X 10.12 |
#6
|
|||
|
|||
![]()
Yes, I am using the rule not the email field in the text box. I tried collecting and uploading and that didn't work. Also, I tried using span tags and it is still not working. I am attaching my collect files. Thanks so much guys!
|
#7
|
||||
|
||||
![]()
Okay well now I understand. The rule in your template is not the same as the rule that you posted to the forum. The rule in your template is missing the "name" property for the "color" tag and it's looking for the HTML entity of the '@' symbol rather than the '@' symbol itself:
Code:
return Field("Email").replace(/& # 6 4 ;/g, '<color ="Black">& # 6 4 ;</color>'); Code:
return Field("Email").replace(/@/g, '<color name="Black">@</color>');
__________________
Ste Pennell FusionPro VDP Creator 9.3.15 Adobe Acrobat X 10.1.1 Mac OS X 10.12 |
#8
|
|||
|
|||
![]()
IT WORKED!! Sorry I've been trying so many variations I must have lost the name property somewhere along the way. Thank you so much!!
![]() |
![]() |
Tags |
change, color, replace, symbol |
Thread Tools | Search this Thread |
Display Modes | |
|
|