0

I am using fields, one has a link, rewriting the link as shown below sending the datetime to webform in the URL. All fields display as they should. When hovering over the link, the URL shows extra space at the end of each field as an underscore as follows. The underscore is not in the datetime field.

2018-05-14T15:39:15-0400_

As seen above the underscore is added. Webform wont prepopulate the datetime field element with the underscore. When manually writing the value, webform correctly prepopulates my webform. The link is /appt_testform?apptdatet={{ field_apptdatet }}&body={{ body }}, which becomes /appt_testform?apptdatet=2018-07-15T18%3A00%3A00-0400_&body=Testing%20the%20appt%2C%20test%20and%20recommend. The underscore after 0400 should not be there.

I see an underscore is added to other fields, which accept values where the datetime will not. I am trying to do this without using hook_form_alter().


After testing on 5 servers using different 8.x versions When importing using feeds module CSV file, If the content field is date and time..imported using feeds then View linked to webform to prepopulate it will add the underscore as shown in the original question. If a field is timestamp (unix number in CSV) after importing, the view rewrite results link does not have the underscore added. I don't know why, however, my site works using the timestamp field type. On all the servers.

10
  • If you switch to the Drupal default theme "Bartik" does the same behavior occur there?
    – No Sssweat
    Jun 27, 2018 at 22:09
  • 2
    Are you able to replicate this on a fresh Drupal install? Can you provide a screenshot of your re-write?
    – No Sssweat
    Jun 27, 2018 at 22:33
  • 1
    You are so right. Laptop version is 8.5.1 and this doesn't happen. Unable to see version of internal network version until tomorrow. Awesome.
    – DStrider
    Jun 27, 2018 at 23:13
  • 2
    Switch those two to 8.5.1 if it doesn't happen there than it must be a Drupal Core bug.
    – No Sssweat
    Jul 4, 2018 at 19:49
  • 2
    Is all of the Drupal files & DB exactly identical in all of these servers? If yes, then it could be an .htaccess rule that is adding the underscores.
    – No Sssweat
    Jul 6, 2018 at 23:00

1 Answer 1

-1

This issue happens when the field value is rendered with HTML (which is appended by Drupal date formats).

In your View, edit your time field and make sure to use Custom formatter rather than any of the predefined ones, and provide the custom pattern in 'Date/time format' field. And then underscore should go. Check this useful answer.

In my case I was struggling with underscore appended after Year value (mysirte.com/tag/1994_), and when I created custom format and used 'Y' the underscore disappeared, see picture: enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.