How do I attach a javascript function on everytime I remove

Posted by Rollbase User on 05-Dec-2011 21:42

For example, I selected an employee from the lookupfeield. I put a javascript function onchange ( hiddenchange attribute), then I hide the textbox element of the lookup. What I want to do next is to put a javascript function to show the textbox element once I removed the selected employee... I tried attaching jquery to the span tru its attribute inputname or to the img via its alt='Remove' but I can't catch it. Please help me ... thank you

All Replies

Posted by Admin on 05-Dec-2011 22:07

We have only "onchange" event handler for Lookup fields due to complexity of this UI component.

Posted by Admin on 05-Dec-2011 22:47

Pavel is correct. If you really want to you can add your own JavaScript to the page to find this element and add event handling code to it.



Martin may have some suggestions for you on the actual implementation, he has had great suggestions on this kind of thing so far



Matt

Posted by Admin on 06-Dec-2011 07:06

Hi All,



Here you go, this should work for the browsers IE7+, FF and Chrome







Just assign the function to your lookup's onchange.

You we're just probably missing the checker for the value of your lookup field that's why you weren't able to identify if there was an item loaded or not.

I used - if (lookupvalue != '' && lookupvalue != null) - you can change this anytime. ^_^



The good thing about lookups is that if you retrieve their value onchange (removing items is considered and onchange) you will get the actual value of the field. I used rbf_getFieldValue fo

Posted by Admin on 06-Dec-2011 07:15

HTML was stripped by getsatisfaction, kindly remove the HTML comments for this to work :)

Posted by Admin on 06-Dec-2011 07:16

HTML was stripped by getsatisfaction, kindly remove the HTML comments before and after the script tags for this to work :)

Posted by Admin on 06-Dec-2011 09:28

Thanks Martin :)

This thread is closed