Forum Discussion

TatianaLeon-dfe's avatar
TatianaLeon-dfe
Community Member
3 months ago
Solved

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!!

  • 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.

2 Replies

  • Nedim's avatar
    Nedim
    Community 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.