dynamic superscript for values in TextField

Avatar

Avatar
Level 1
muraliv29958402
Level 1

Likes

0 likes

Total Posts

11 posts

Correct reply

0 solutions
View profile

Avatar
Level 1
muraliv29958402
Level 1

Likes

0 likes

Total Posts

11 posts

Correct reply

0 solutions
View profile
muraliv29958402
Level 1

30-11-2017

Hello,

I wanted to add a superscript dynamically to the values comes in sample xml. I cannot hard code the superscript in textfield because the values populated from sample xml. is there a way to achieve this?

I have see few posts about super script but they did not really help my requirement. I am attaching the screenshot how I need the output to be.

All the data (product name, category, code ..) comes from sample xml. I need to add superscript to Product based on some logic.

I tried something like making the textfield as Richtext and append the superscript but no luck.

Textfield.rawvalue = xfa.resolveNode("xfa.record.main.Productname").value + <sup>1</sup>

Any help please?LC.png

Thanks

Krish

Replies

Avatar

Avatar
Coach
MVP
radzmar
MVP

Likes

397 likes

Total Posts

2,687 posts

Correct reply

492 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile

Avatar
Coach
MVP
radzmar
MVP

Likes

397 likes

Total Posts

2,687 posts

Correct reply

492 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile
radzmar
MVP

30-11-2017

You can do so. You'll need at least an invisible plain text field which gets populated by the XML and a RichText field, which will display values plus superscripted numbers for endnotes etc. With a few lines of JavaScript you'll get you result.

var cSourceText = PlainTextField.rawValue,

    cSuperScript = "1",

    xHTML = "<body xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:xfa=\"http://www.xfa.org/schema/xfa-data/1.0/\"><p style=\"letter-spacing:0in\">" + cSourceText + "<sup>" + cSuperScript + "</sup></p></body>";

RichTextField.value.exData.loadXML(xHTML, false, true);

Avatar

Avatar
Level 1
muraliv29958402
Level 1

Likes

0 likes

Total Posts

11 posts

Correct reply

0 solutions
View profile

Avatar
Level 1
muraliv29958402
Level 1

Likes

0 likes

Total Posts

11 posts

Correct reply

0 solutions
View profile
muraliv29958402
Level 1

30-11-2017

Thank you. I just did how you mentioned. But no luck. my rich text fiels is empty. I have written this code in Calculate event of the richtext field. and value for Plain text field is coming from sample xml. Not sure why it is not working for me.

Avatar

Avatar
Coach
MVP
radzmar
MVP

Likes

397 likes

Total Posts

2,687 posts

Correct reply

492 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile

Avatar
Coach
MVP
radzmar
MVP

Likes

397 likes

Total Posts

2,687 posts

Correct reply

492 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile
radzmar
MVP

30-11-2017

This is a side effect of the calculate event in the target text field. The value is there but not displayed by the text fields widget.

Add the script in the calculate event of another element like a surrounding subform or a hidden button.

1362292_pastedImage_1.png

Avatar

Avatar
Level 1
muraliv29958402
Level 1

Likes

0 likes

Total Posts

11 posts

Correct reply

0 solutions
View profile

Avatar
Level 1
muraliv29958402
Level 1

Likes

0 likes

Total Posts

11 posts

Correct reply

0 solutions
View profile
muraliv29958402
Level 1

06-12-2017

It worked. Thank you so much