:: Forum >> Version 2 >>

How to set width of two sets of text inputs

I am having a great time using this library. But there are a few questions.

How can I set the width of an Input using a style class?
I can set each input's width using the setStyle() method:
var custName = new AW.UI.Input;
custName.setStyle('width','250px');

But there seems to be no way to set the "width" property using CSS.

Keep in mind that I have two classes of inputs.
e.g. customer and creditcard information are presented in two DIVs and we want to have different size fields for each "class" of intputs.

Thanks
Mike
mikech
Friday, November 3, 2006
Use setId() method and #id CSS selector -

<style>

#customer {
    
width200px;
}

#creditCard {
    
width50px;
}

</
style>
<
script>

    var 
obj1 = new AW.UI.Input;
    
obj1.setId("customer");
    
document.write(obj1);

    var 
obj2 = new AW.UI.Input;
    
obj2.setId("creditCard");
    
document.write(obj2);


</
script>
 
Alex (ActiveWidgets)
Monday, November 6, 2006
or, if you have several controls with the same style use setClass method -

http://www.activewidgets.com/aw.system.html/setclass.html

<style>

.
aw-group-customer {
    
width200px!important;
}

.
aw-group-card {
    
width50px!important;
}


</
style>
<
script>

    var 
obj11 = new AW.UI.Input;
    
obj11.setClass("group""customer");
    
document.write(obj11);

    var 
obj12 = new AW.UI.Input;
    
obj12.setClass("group""customer");
    
document.write(obj12);

    var 
obj21 = new AW.UI.Input;
    
obj21.setClass("group""card");
    
document.write(obj21);


</
script>
 
Alex (ActiveWidgets)
Monday, November 6, 2006
The second example is what I am looking for.
Thanks!
mikech
Tuesday, November 7, 2006



This topic is archived.

Back to support forum

Forum search