Forum Discussion
TatianaLeon-dfe
1 year agoCommunity Member
Control Chars on Entrytext
Hi everyone!
I´ve been trying to limit characters by using JavaScript programming, but it does not work!
Anybody could help me?
Thanks!!
- 1 year ago
You should use >= instead of ≥. Don’t use a keyboard shortcut to insert the "greater than or equal to" operator — use the correct JavaScript syntax.
If that’s not the issue, try inserting the code below. It works in the attached .story file when the user clicks the Submit button.
var player = GetPlayer(); if(player.GetVar('entradadetexto').length >= 5) { alert('it is too long'); player.SetVar('isDisabled', false); } else { player.SetVar('isDisabled', true); }If it still doesn’t work, upload your slide so someone can take a look at the triggers setup.
Nedim
1 year agoCommunity Member
You should use >= instead of ≥. Don’t use a keyboard shortcut to insert the "greater than or equal to" operator — use the correct JavaScript syntax.
If that’s not the issue, try inserting the code below. It works in the attached .story file when the user clicks the Submit button.
var player = GetPlayer();
if(player.GetVar('entradadetexto').length >= 5) {
alert('it is too long');
player.SetVar('isDisabled', false);
} else {
player.SetVar('isDisabled', true);
}
If it still doesn’t work, upload your slide so someone can take a look at the triggers setup.
Related Content
- 1 year ago