Score:0

Set default values of a webform element from a field on a user account

cn flag

On a user account I have field field_hourly_rate which is a price field (I can also use a number field for it) and I am trying to set the field as default value of an element for a webform placed on the user account page.

I have tried [current-user:field_hourly_rate], [current-page:query:field_hourly_rate], [webform_submission:user:field_hourly_rate], [webform_submission:source-entity:field_hourly_rate], {{ webform_token('[current-page:query:field_hourly_rate]') }}

None of them worked.

EDIT:

This is how I finally was able to solve this: I installed the module Current Page Entity Tokens, https://www.drupal.org/project/current_page_entity_tokens and it made tokens available for the user who owns the profile being viewed and so I was able to get the token [current-page:user:field_hourly_rate] I added the token in the webform computed token element and pulled the value from the user account. Meanwhile because I wanted to make computations with the value the price field didn't work because it was coming bundled with the currency so I changed to a number field and everything worked.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.