Documentation / Tutorials / SPA

Event: Submit - single submit button

/ SPA / Event: Submit - single submit button

[templates.add basic_form]

//** HTML novalidate: to disable html 5 validations **//
<section role='xyz-form'>
<form id="scheme_form" novalidate>

//** Form fields in bootstrap format **//
<div class="form-group">
Field Label
Field Element
<div class='help-block'></div>

<button type='submit' class='btn btn-primary'>Submit</button>

//** Java Script to bind form submit **//
<script type=spa/axn
data-safe_id=[app.safe_id/] >


[templates.add basic_form_submit]
avoid using direct request params always take request param in variable and use variable
[template.set req='{request}' /]

//** server side validate and process data **//

//** Update section with thank you block **//
<template axn=control.update control='' get='me.html' data-safe_id=[app.safe_id/]>

<h5>html to put into section</h5>

Sample: how to run script after submit

<script type=spa/axn axn='core.run_script' data-safe_id=[app.safe_id/]>
alert("Cool script run after submit");

Sample: page redirect
Empty url will reload current page
you can use alert & confirmation on any script tag
attribute: alert='Your data is submitted'
attribute: confirmation='Your data is submitted, do you want to reload page '
Sample: <script type=spa/axn axn='core.redirect' url='' data-safe_id=[app.safe_id/] confirmation=''>

<script type=spa/axn axn='core.redirect' url='' data-safe_id=[app.safe_id/]></script>


Most Popular

Leave a Reply

Your email address will not be published.