1

When I go to the build tab of the webform and click edit on the date element, I can find the default value setting under the advanced tab in the element editor. The help text says I can use tokens, but I'm having trouble making a token work there. (I'm trying to use the [current-date:html_date] token).

If I click "set default value", another dialog opens with a text input and a button that says "update default value". But when I click that button after putting the token into the input, it goes back to the advanced tab and the default value input is empty. If I enter the token before clicking "set default value", the "update default value" dialog opens with an empty input. I've tried various combinations/orders and can't get the token to stay there. It doesn't matter if I type it in, copy/paste it, or fill it using the "browse available tokens" tool.

1 Answer 1

2

Leave the "set default value" button alone. Something about it makes it seem like a really good button to click for setting a default value, but you don't need it. Just enter the token in the default value input on the advanced tab and click save.

This seems simple enough in hindsight, and I'm not sure why it took so long for it to occur to me to try it. Hopefully if someone else has the same problem, this answer can help save them a few minutes, or perhaps even a longer period of time we won't mention here.

3
  • 1
    Yep, the 'Set default value' button is only needed for complex default values including composites and multiple value elements.
    – jrockowitz
    Commented Feb 11, 2019 at 18:55
  • 1
    Ah, I see. After I figured out what I had been doing wrong I was wondering what it actually was for. I hadn't needed to do anything like that yet so hadn't encountered it. Thanks for the clarification! Commented Feb 11, 2019 at 19:12
  • Thanks for posting this solution! The "set default value" button, like much in Drupal, makes no sense. Commented Aug 3, 2023 at 11:32

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.