:: Forum >>

input text and input password don't work on same grid

Hi,

In the grid code below, I have 2 input boxes - one of type text and the other is changed to type password using setAttribute().
However, both are rendered as type text in version 2.0.1.

The strange part is that if you comment out this line, the password box is actually of type password :
obj.setCellTemplate(inp,1,1)

How can I have an input text and input password box in the same grid ? Please help !!

Thanks,
Ankur


var inp = new AW.UI.Input;
inp.setId("myInput");

var pas = new AW.UI.Input;
pas.setId("myInput1");

var obj = new AW.UI.Grid;
obj.setCellText(function(i, j){return j + "." + i});
obj.setHeaderText("header");

obj.setColumnCount(10);
obj.setRowCount(100);

obj.setCellTemplate(inp,1,1);
obj.setCellTemplate(pas,2,2);
pas.getContent("box/text").setAttribute("type", "password");

document.write(obj);
Ankur Motreja
Friday, September 22, 2006
Hi,

It just became a bit more strange.
It works if you want to put the password box in a cell before the input box, but not the other way round.

In the above example, just change the line

obj.setCellTemplate(pas,2,2);

to

obj.setCellTemplate(pas,0,0);

This works because the password box is before the input text box !!
But if you want the password box in a cell after the input text box, I haven't found any solution.

Thanks,
Ankur
Ankur Motreja
Friday, September 22, 2006
anyone ?
Ankur Motreja
Saturday, September 23, 2006
bump
Ankur Motreja
Sunday, September 24, 2006
This is a bug in AW related to the caching of the html fragments. The workaround is to clear html cache manually on the control and intermediary level ('box' content).

var inp = new AW.UI.Input;
inp.setId("myInput");

var pas = new AW.UI.Input;
pas.setId("myInput1");
pas.getContent("box/text").setAttribute("type", "password");
pas.getContent("box")._innerHTML = "";
pas.getContent("box")._outerHTML = "";
pas._innerHTML = "";
pas._outerHTML = "";

...
Alex (ActiveWidgets)
Monday, September 25, 2006
Thanks Alex.
That works.

Ankur
Ankur Motreja
Monday, September 25, 2006
Hi,

Another workaround seems to be using the toString() method.
It also seems to be doing the same thing.

Here's the code (only addition to my first post is pas.toString() ):

var inp = new AW.UI.Input;
inp.setId("myInput");

var pas = new AW.UI.Input;
pas.setId("myInput1");

var obj = new AW.UI.Grid;
obj.setCellText(function(i, j){return j + "." + i});
obj.setHeaderText("header");

obj.setColumnCount(10);
obj.setRowCount(100);

obj.setCellTemplate(inp,1,1);
obj.setCellTemplate(pas,2,2);

pas.getContent("box/text").setAttribute("type", "password");
pas.toString();

document.write(obj);
Ankur Motreja
Tuesday, September 26, 2006
ALEX,

Do you have any plans or ideas on how to fix the "bug in AW related to the caching of the html fragments" you mentioned above?

I'm trying to get a few templates for some things like a password box, textarea, etc. etc. and it just doesn't look like I should have to put in the manual cache flushing in my AW.UI.Password.create function.

AW.UI.Password = AW.UI.Input.subclass();
AW.UI.Password.create = function(){
    var obj=this.prototype;
    obj.getContent('box/text').setAttribute('type', 'password');
    obj.getContent("box")._innerHTML = "";
    obj.getContent("box")._outerHTML = "";
    obj._innerHTML = "";
    obj._outerHTML = "";
};

var PasswordField = new AW.UI.Password;
PasswordField.setPosition(800,10);
document.write(PasswordField);
John Mason
Thursday, December 21, 2006

This topic is archived.


Back to support forum

Forum search