Actually /did -j does not undo whatever you have typed in the editbox. All it does is reset $did().edited to $false. Open up your dialog, type something in the editbox and then type
//echo -a $did(npl_make_sid,1).edited
you get $true
now type:
//did -j npl_make_sid 1 | echo -a $did(npl_make_sid,1).edited
you get $false
As for the actual problem, I've written an alias that makes editboxes accept only numbers (digits). Here it is:
[color:green]; /numbersonly <dialog name> <id of editbox> [max number][/color]
alias numbersonly {
var %a = $did($1,$2), %s = $did($1,$2,1).selstart
if $mid(%a,%s,1) !isnum { did -ra $1-2 $remove(%a,$ifmatch) | did -c $1-2 1 %s }
if $did($1,$2) > $3 { did -ra $1-3 | did -c $1-2 1 -1 }
}
You can then use it in your edit event, like this:
on *:dialog:npl_make_sid:edit:1: numbersonly $dname $did 1000
This would make the editbox accept only digits and only when the number is smaller or equal to 1000. If you don't want an upper limit, just omit 1000.