Jump to content

How to add afterrender-code in runtime


cdev

Recommended Posts

Hi,

I have a TUniEdit component with the following property:

ClientEvents.ExtEvents.afterrender:

function afterrender(sender, eOpts)
{
    var me=sender;
    me.inputEl.setStyle('text-align','left');
    me.setEmptyText('123');
    me.inputEl.setStyle('background-image', 'url(./images/Required-a-16.png)');    
    me.inputEl.setStyle('background-repeat', 'no-repeat');
    me.inputEl.setStyle('background-position', 'center right');
    me.inputEl.setStyle('border', '1px solid #ff9999');    
}

this aligns the text in the edit area to the left, sets the emptyText to '123' to indicate we expect numeric input, sets a small icon at the right of the input area to indicate it is a required field and draws the borders of the input area in a red color.

This works fine.

What I want to do is to have initially that edit-component exactly the same without the red borders.  Only when a button is clicked and there is no input in that component, that the borders get red.

So, based on the input of that component the last line should be added or removed.

(me.inputEl.setStyle('border', '1px solid #ff9999'); ) 

How do I do this in runtime ? 

Link to comment
Share on other sites

  • 2 months later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...