EasyManuals Logo

Embedded Systems LM5p-GSMC User Manual

Default Icon
291 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #58 background imageLoading...
Page #58 background image
58
Example (config.html)
Create a simple for element with single numeric input which accepts values in 0..100 range
<form id="myapp-config">
<div class="form-group">
<label for="myapp-input">Numberic input</label>
<input type="number" name="input" id="myapp-input" class="form-control" min="0"
max="100">
</div>
</form>
<script>
(function() {
var el = $('#myapp-config') // form element
, input = $('#myapp-input'); // input element
// set element values when config is loaded
el.on('config-load', function(event, data) {
$.each(data, function(key, value) {
$('#myapp-' + key).val(value);
});
});
// runs when Save button is clicked
el.on('config-check', function() {
var val = parseInt(input.val(), 10) // input value
, min = parseInt(input.attr('min'), 10) // minimum value
, max = parseInt(input.attr('max'), 10); // maximum value
// invalid value
if (isNaN(val) || val < min || max < val) {
alert('Please enter a value between ' + min + ' and ' + max);
}
// all good, save configuration
else {
el.triggerHandler('config-save', { input: val });
}
});
})();
</script>

Table of Contents

Other manuals for Embedded Systems LM5p-GSMC

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Embedded Systems LM5p-GSMC and is the answer not in the manual?

Embedded Systems LM5p-GSMC Specifications

General IconGeneral
BrandEmbedded Systems
ModelLM5p-GSMC
CategoryDimmer
LanguageEnglish

Related product manuals