Read these AEM Sightly Articles - there is a lot of code that shows this: https://helpx.adobe.com/experience-manager/using/movie.htmlhttps://helpx.adobe.com/experience-manager/using/aem_headline.html
This requirement can be solved using JQuery: https://www.formget.com/jquery-registration-form/You can easily use JQuery with AEM. See: https://helpx.adobe.com/experience-manager/using/integrating-jquery-framework-cq.html
I am not sure this is support in AEM out of the box. That is - child pages rendering content based on parent page content. Look like this may have to be a custom solution.
I gave seen similar threads lije this before. Other community members have stated ysing custom tags is better as discussed here: https://helpx.adobe.com/experience-manager/using/customtags1.html