-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.html
More file actions
32 lines (32 loc) · 1.28 KB
/
test.html
File metadata and controls
32 lines (32 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<!DOCTYPE html>
<html>
<head>
<script src="//js.jotform.com/JotFormCustomWidget.min.js"></script>
</head>
<body>
<div id="main">
<h3>This is my first widget.</h3>
<span id="labelText"></span>
<input type="text" id="userInput">
</div>
<script type="text/javascript">
//always subscribe to ready event and implement widget related code
//inside callback function , it is the best practice while developing widgets
JFCustomWidget.subscribe("ready", function(){
var label = JFCustomWidget.getWidgetSetting('QuestionLabel');
document.getElementById('labelText').innerHTML = label;
//subscribe to form submit event
JFCustomWidget.subscribe("submit", function(){
var msg = {
//you should valid attribute to data for JotForm
//to be able to use youw widget as required
valid: true,
value: document.getElementById('userInput').value
}
// send value to JotForm
JFCustomWidget.sendSubmit(msg);
});
});
</script>
</body>
</html>