Forum Discussion
Numeric Entry equal to a specific value
- 1 year ago
I was able to do this, but had to resort to JavaScript. Using this method, the input box will be set to 150 if the input box current value is empty. I have included a very basic storyline file demonstrating the functionality.
initEvents = function() { const numberinput = document.querySelectorAll('input[type=text].acc-clickable'); numberinput.forEach(function (input) { input.addEventListener('click', function (e) { console.log("click"); if (e.target.value === "") { e.target.value = "150"; e.target.dataset.dv_value = "150"; const inputid = e.target.id.replace("acc-", ""); const inputvisible = document.querySelector('.slide-object-textinput.shown[data-model-id="'+inputid+'"] input[type=text]'); inputvisible.value = "150"; inputvisible.dataset.dv_value = "150"; } }); }); } setTimeout(initEvents,100); - 1 year ago
Hi Jennifer,
I have attached the .story file for your review. While Sam's JavaScript solution worked for me, I used a button that changes its state when the user clicks on the numeric entry field. Depending on the button state, the numeric field is set to a value of 150. I was just thinking of an easy and simple solution that would not include JavaScript.
I was able to do this, but had to resort to JavaScript. Using this method, the input box will be set to 150 if the input box current value is empty. I have included a very basic storyline file demonstrating the functionality.
initEvents = function()
{
const numberinput = document.querySelectorAll('input[type=text].acc-clickable');
numberinput.forEach(function (input) {
input.addEventListener('click', function (e) {
console.log("click");
if (e.target.value === "") {
e.target.value = "150";
e.target.dataset.dv_value = "150";
const inputid = e.target.id.replace("acc-", "");
const inputvisible = document.querySelector('.slide-object-textinput.shown[data-model-id="'+inputid+'"] input[type=text]');
inputvisible.value = "150";
inputvisible.dataset.dv_value = "150";
}
});
});
}
setTimeout(initEvents,100);
Related Content
- 2 months ago
- 1 year ago