Closed (fixed)
Project:
Webform
Version:
7.x-4.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
18 Mar 2014 at 21:13 UTC
Updated:
2 Sep 2014 at 16:30 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
quicksketchI can't reproduce this problem. I set up a form with a date field and a text field. I made the default value of the field "today". Then I set up a conditional that said "If date field is before today hide text field". On page load, the field is shown. If I change the date to one day before, the field is hidden, as it should be.
Comment #2
epersonae2 commentedI had the same issue.
Very simple form, two fields: a date field and a select options field. (The same issue occurred with a date field and a text field.)
The condition: "If the date is after today, show the field."
When they were on the same page, selecting *any* date showed the field.
The same thing happened if the rule was "If the date is after today, hide the field." -- Selecting any date hid the field.
If I put the select options field on the next page, then it worked correctly.
Comment #4
danchadwick commentedTwo problems. One easy, one harder.
The easy is that the jQuery Drupal.webform.conditionalOperatorDateEqual calls Drupal.webform.timeValue rather than dateValue.
The harder is that 32-bit hardware doesn't support UNIX Epoch time format converted to milliseconds (the format used by javascript Date.UTC()). Dates around the current date just barely fit in 32 bits. Javascript uses 64 bit floating point numbers, which have a 53 bit mantissa. This is sufficient for milliseconds.
Rather than sending milliseconds to the browser, the solution is to send seconds and do the conversion in javascript.
Comment #5
epersonae2 commentedThank you! It works great now. :)