Dynamically Updating a Component Placeholder on Page Load Using a Component Exposed Variable

Hello everyone,

I’m encountering a challenge where I need to dynamically update the placeholder inside my component on page load. The variable that is triggered by the function that update the placeholder, is a component exposed variable. The variable updates correctly during the page load based on certain criteria and workflows. However, the issue arises with the function responsible for updating the placeholder—it does not automatically trigger after the variable updates during the page load.

Problem: Even though the component variable is correctly updated before the component renders, the placeholder update function does not execute, leaving the placeholder outdated upon initial page load.

Objective: My goal is to ensure that as soon as the page loads and the variable is updated, a specific function triggers to refresh the placeholder. This way, users will see the updated placeholder immediately when they land on the page.

Here is some context :

As mentioned, the placeholder value in the log activity should be “5 Adults” and should appears like this on the button placeholder. The function to update the placeholder is in the component. The buttons[0].value is updated on page load.

Hope I’m clear enough, please don’t hesitate to ask anything that may help.

Thank you very much !

I made a video about subscribing to arbitrary variable changes in weweb - maybe it helps? I take a javascript approach:

1 Like