3.2.0

maxlength in input object

hi. how do i limit length of input object. in normal html, it is done via maxlength. setattribute(maxlength,5) does not work when i tried it.
jc
August 14,
http://www.activewidgets.com/javascript.forum.22490.1/how-to-fix-maxlength-in.html
Alex (ActiveWidgets)
August 14,
i tried that one. it doesn't work. using ie7. here's my code:

thisID = "edtBox" + 5;
var thisID = new awInput(thisID, InputPositions[0], InputPositions[1], InputPositions[2], InputPositions[3], InputTypes[i]);
thisID.getContent("box/text").setAttribute("maxlength", 2);
thisID.refresh();
jc
August 14,
Try this -

var obj = new AW.UI.Input;
obj.getContent("box/text").setAttribute("maxlength", 2);
document.write(obj);
Alex (ActiveWidgets)
August 14,
yes, it works. my problem is that i have automated this in a function so as to avoid retyping a whole code. the function contains all the necessary coding to create an object and i only pass it the script as above. it seems like once document.write() executes, setattribute will not work .. no?i'm still looking for a way out.
jc
August 14,
Could it be that you accidentally have another object with the same ID?
Alex (ActiveWidgets)
August 14,
it is in a loop, assigning id dynamically by concatenating id and number thereby creating uniq id.
jc
August 14,

This topic is archived.

See also:


Back to support forum