I am deveoping a small plugin that needs to alter the registration and comment forms to add 4 hidden fields that have data inside that I gather from the configuration panel, and when the form is submitted, a js onlick event must be called to send those 4 hidden field data (it's a tracking software similar to google analytics).
The first issue is that the fields are hidden, so the data is not entered by the user. I need to fill those fields data with:
<?php echo $params->get('my_param'); ?>
but on those tutorials I don't see any example on how to fill the fields when the form is loaded. I'm also lost on how to attach a js onclick event to the submit form. It is enough to implement onAfterRender()?
EDIT: The registration form is the one where an user register to the joomla cms. The comment form is any comment form added by a third party extension below posts and pages.