Calculating age from DOB | XM Community
Skip to main content

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!

@kblessing 

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


@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