how to shift the text field to occupy the space of hidden text field.

I am having some text fields which i am hiding/showing based on radio button check. but when the particular text fields are hidden, i want other text fields to move up. When the hidden text field is visible again the rest of text fields should regain its previous position.
How it can be done using Javascript. Or is there any other way to it.


Khushali Solanki


2 Answers

This can be done using JavaScript, and is, in fact, pretty easy.

The field property to look at is rect . It is an array of the coordinates of the upper left and the lower right corner of the field.

You either know the coordinates of the field where it should be when moved, then you simply set them, or, you know by how much it has to be moved. The example below is a code snippet to move the field up by the value "offset":

var orirect = this.getField("myField").rect ;
var newrect = [orirect[0], orirect[1]+offset, orirect[2], orirect[3]+offset] ;
this.getField("myField").rect = newrect ;

and that should do it.

Hope this can help.

Max Wyss.


Max Wyss   

Thanks for quick reply.

Actualy I am new to this so I am little confused.

I just need to know one more thing that where do I write the code u gave.

I tried putting it in javascript, which runs when in checkbox checkd is changed.

I have attached the screen shot.

On Exit, I have hide some textbox fields, so the rest of the textfield (e.g Customer system,etc) should move up.

Please help.


Khushali Solanki   


Please specify a reason: