Validation for Time (In Hours) Based on Responses to 2 Previous Questions | Experience Community
Skip to main content
Question

Validation for Time (In Hours) Based on Responses to 2 Previous Questions

  • August 24, 2026
  • 3 replies
  • 86 views

Forum|alt.badge.img

Hello! 

Let’s say: I have Q1 which asks what time people usually go to bed (in 24 hour hh:mm format), and Q2 which asks what time people usually wake up (also 24 hour hh:mm format). 

Q3 asks approximately how many hours people sleep on average. If the answer to Q3 is more than the number of hours between Q1 and Q2, I want it to return an automatic error message. 

How do I do this using custom validation or javascript? Thank you in advance!! 

3 replies

nikamshubham73
Level 3 ●●●
Forum|alt.badge.img+4
  • Level 3 ●●●
  • August 24, 2026

Hi ​@sumyee_h,

This is doable via the Custom Validation, what question type are you using to differentiate the hh and mm? Is it in a single Text Box? Or two different? 


Forum|alt.badge.img
  • Author
  • August 25, 2026

Hi ​@nikamshubham73! I am using just one form field.  


TusharDalwani
QPN Level 6 ●●●●●●

Hi, you can calculate the number of hours from Q1 & Q2 and save it as an embedded data field, then in Q3 you can add custom validation that the answer should be less than what the value is in embedded data field.