Activating Methods on page load or button click
Once you've created your Smart Contract method instance, optionally gathered your users inputs (not all methods require inputs!) now we need to invoke our method- Activate it!
We can invoke a method in one of two ways: on page load, when your website first loads for the user, or by clicking a button.
To invoke on page load, all you need to do is add
data-dh-property-auto-invoke="true"to the method instance element we created earlier (thats the one that has the
This will now auto-invoke a method on page load. This is useful for when you want to pre-populate some data on your website from a smart contract without needing to user to click on a button first.
Invoke on page Load will only work for View Methods. Transactions can not be invoked on page.
If you want your user to invoke the method, create a button instance and add the tag
data-dh-property-invokethis will tell the DappHero engine to invoke the smart contract method when the button is clicked.
Click Here to Call Your Smart Contract!