cristianotestai Posted November 16, 2011 Share Posted November 16, 2011 Hi Farshad, Use the event below to place an image in UniEdit and works ok! OnAfterrender function (sender) { sender.getEl().setStyle('background-image', "url ([url="http://localhost:8077/ext-3.4.0/resources/images/search.gif"]http://localhost:807...ages/search.gif[/url])"); } What I am not able to do is use the Event "OnEnter" of "UniEdit" to add in runtime the UniSession.AddJS command under certain condition. I'm trying: procedure TfmContato.edFiltroNomeEnter(Sender: TObject); begin if (edFiltroNome.Text = 'buscar') and (edFiltroNome.Font.Color = $00B5B5B5) then begin UniSession.AddJS('fmHome.edFiltroNome.getEl().setStyle(' + QuotedStr('background-image') + ', "url([url="http://localhost:8077/ext-3.4.0/resources/images/search.gif"]http://localhost:807...ages/search.gif[/url])");'); end; end; And AjaxError occurs: Can not call method 'getEl' of undefined. I do not understand why that the method is not defined, if it is used in OnAfterrrender, where the object "edFiltroNome" is the same object. How to do the same as the event OnAfterrender at runtime using the UniSession.AddJS and also, how to eliminate the code in the event OnExit later? Attached the error image. Thanks. Quote Link to comment Share on other sites More sharing options...
cristianotestai Posted November 16, 2011 Author Share Posted November 16, 2011 The image attached.. Quote Link to comment Share on other sites More sharing options...
thecrgrt Posted November 16, 2011 Share Posted November 16, 2011 Where is "fmHome" was defined? IMO, it's safer when we reference to component's name property instead of a constant one. Quote Link to comment Share on other sites More sharing options...
cristianotestai Posted November 16, 2011 Author Share Posted November 16, 2011 Where is "fmHome" was defined? IMO, it's safer when we reference to component's name property instead of a constant one. Hi, fmHome is my MainModule name. I'm using the constant because it is the name of MainModule, to which the principle in this project will always be 'fmHome'. Regards. Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted November 21, 2011 Administrators Share Posted November 21, 2011 Hi Farshad, Use the event below to place an image in UniEdit and works ok! OnAfterrender function (sender) { sender.getEl().setStyle('background-image', "url ([url="http://localhost:8077/ext-3.4.0/resources/images/search.gif"]http://localhost:807...ages/search.gif[/url])"); } Please send a test case. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.