Permalink
Switch branches/tags
Nothing to show
Find file Copy path
95c3c68 Mar 5, 2018
2 contributors

Users who have contributed to this file

@egerb @hlorofos
82 lines (76 sloc) 3.29 KB
<html>
<head>
<link rel='stylesheet' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css'>
<link rel='stylesheet' href='https://unpkg.com/formiojs@latest/dist/formio.full.min.css'>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src='https://unpkg.com/formiojs@2.29.9/dist/formio.full.min.js'></script>
<script type='text/javascript'>
//Change this demo data for your own credentials if needed
var formUrl = 'https://aqeylmxqmkjkyqi.form.io/purchaseorderform';
var webhookUrl = 'https://onkranxx.api.processmaker.io/api/v1/processes/Purchase/events/StartEvent/webhook';
//Change this demo data for your own credentials if needed
window.onload = function() {
Formio.createForm(document.getElementById('formio'), formUrl).then(function(form) {
form.submission = {
//Prefilled data, uncomment if need
data: {
//requesterName:'John Doe',
//requesterEmail:'demo@processmaker.com',
//orderNumber: 12,
//orderDate:Date(),
//itemName:'My item name',
//itemCost:100000,
//itemQty:2,
//purchaseSum:200000,
//purchaseGoal:'Comment text here'
}
};
//Sending data to environment
//Start comment this function, if used Form IO Webhook Premium Action
form.on('submit', function(submission) {
var data = {
request : submission
}
console.log(submission);
axios
.post(webhookUrl, data)
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
});
//End comment this function, if used Form IO Webhook Premium Action
});
};
</script>
</head>
<body>
<div class="col-xs-10 col-xs-offset-1">
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Purchase request demo</a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<!--Change this navigation links before publish forms in some other place-->
<li class="active"><a href="https://processmaker.github.io/pmio-purchase-request">Request form<span class="sr-only">(current)</span></a></li>
<li><a href="https://processmaker.github.io/pmio-purchase-request/index2.html">Approve form</a></li>
<!--Change this navigation links before publish forms in some other place-->
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
<div id='formio'></div>
</div>
</body>
</html>