Hello Teamsite 16.7
I have my content footer component that contains a form. This form when submitted should do some javascript then call my controller action and the page should not be reloaded.
I have the controller and method mapped in my component XML
<Data>
<Datum ID="PositionalEmail" Name="EmailAddress" Label="Add the email address for your sites positional mailbox" Type="String"/>
<Controllers>
<Controller Name="PageFeedback">
<Object Scope="local">cs.gc.forces.livesite.controller.form.ContentFooterController</Object>
<Method>sendFeedback</Method>
</Controller>
</Controllers>
<!--
<Group ID="footnotes" Name="FOOTNOTES ("+" to add; "X" to delete; arrows to reorder)" Replicatable="true" CloneGroupID="Footnotes">
<Datum ID="footnote" Type="String" Name="footnote" Label="Footnote text:"/>
</Group>
-->
<External>
<Object Scope="local">ca.gc.forces.livesite.external.core.FooterExternal</Object>
<Method>getContentFooter</Method>
</External>
</Data>
and this form in xsl
<form id="feedbackYes" method="post" class="wb-postback wb-disable-allow" type="external">
<fieldset class="gc-pft-btns chkbxrdio-grp row row-no-gutters d-sm-flex flex-sm-wrap align-items-sm-center">
<legend class="col-xs-12 col-sm-7 nojs-col-sm-12 col-md-9 col-lg-8 text-center text-sm-left nojs-text-left mrgn-tp-sm pr-sm-3">
<span class="field-name"><xsl:value-of select="$labels/label[@key='component.footer.page-feedback-question']"/></span>
</legend>
<div class="col-xs-12 nojs-hide">
<button name="helpful" value="Yes-Oui" class="btn btn-primary" aria-describedby="gc-pft-why"><xsl:value-of select="$labels/label[@key='component.footer.yes']"/></button>
</div>
<div class="col-xs-12 col-sm-5 col-md-3 col-lg-4 text-center text-sm-right nojs-show">
<button type="submit" value="Yes-Oui" class="btn btn-primary" onclick="handleYesClick(event)"><xsl:value-of select="$labels/label[@key='component.footer.yes']"/></button>
<button type="button" class="btn btn-primary mrgn-lft-sm" onclick="handleNoClick(event)"><xsl:value-of select="$labels/label[@key='component.footer.no']"/></button>
</div>
</fieldset>
</form>
and its asscoiated JS
function handleYesClick(event) {
event.preventDefault();
document.querySelector('.gc-pft-thnk').classList.remove('hide');
document.querySelector('.gc-pft-btns').classList.add('hide');
setTimeout(function() {
document.getElementById('feedbackYes').submit();
}, 1000);
return false;
}
And my controller action with a logging statement to test access.
public class ContentFooterController {
private static final Log LOGGER = LogFactory.getLog(ContentFooterController.class);
public ForwardAction sendFeedback(RequestContext context) {
LOGGER.debug("inside the controller method");
// don't redirect page return null; }
}
when I click yes, the page reloads and I dont recieve any debug statement in my livesite runtime logs.
am I missing some kind of mapping? I was under the impression that mapping a controller action in the component xml would trigger on a submit