Calculating age from DOB | XM Community
Skip to main content
Question

Calculating age from DOB

  • December 12, 2023
  • 2 replies
  • 107 views

Forum|alt.badge.img

Hello! 

I have a survey question asking for DOB, and I am hoping to calculate age in an embedded data field to use within branching logic. I have read through many other threads and found this linked from @TomG - I have added the HTML code to the header, added an embedded data field named “__js_age” prior to the block with the DOB question, and have added the javascript code to the DOB question, yet it is still not working for me. Are there any steps I am missing in order to have this run correctly?

Thank you in advance for your help!

2 replies

Deepak
QPN Level 8 ●●●●●●●●
Forum|alt.badge.img+44
  • 1553 replies
  • December 12, 2023

@kblessing 

The embedded data is just “age” and not “__js_age”. Try changing it.


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 5938 replies
  • December 12, 2023

@kblessing - if you are using setJSEmbeddedData then __js__age is correct. Are you using Simple layout? If so, you need to load jQuery and change the input field selector.


Leave a Reply