Hi,

I am not 100% sure, I got you, but you want to trigger an event
(onchange), when there was no onchange, but onclick (for instance) ?

See:
http://www.howtocreate.co.uk/tutorials/javascript/domevents
"Manually firing events"

That allows you to do things like:
<html>
<body onload="init();">
<script>
function changeValue() {

       var fireOnThis = document.getElementById('bar');
 fireOnThis.value = fireOnThis.value + "A";

       if( document.createEvent ) {
               var evObj = document.createEvent('HTMLEvents');
               evObj.initEvent( 'change', true, false );
               fireOnThis.dispatchEvent(evObj);
       } else if( document.createEventObject ) {
               fireOnThis.fireEvent('onchange');
       }

}

function mySecondListener() {
 alert("this rocks");
}

function init()
{
 var referenceToElement=document.getElementById('bar');
 if(referenceToElement.attachEvent)
 {
   referenceToElement.attachEvent('onchange',mySecondListener);
 }
 else if(referenceToElement.addEventListener )
 {
   referenceToElement.addEventListener('change',mySecondListener,false);
 }
}


</script>


<input id="bar" type="text" onchange="alert('onchange');"/>
<button id="foo2" onclick="changeValue();">bar2</button>

</body>
</html>


On Dec 3, 2007 9:59 AM, Michael Borchert
<[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I try to have a table populated on the immediately (with a small
> timeout ) when an input field changes.
>
> I've done it this simple way below, it works but is not really what I
> want. I want the onchange wto trigger if there was no key pressed for
> xxx ms.
>
> As I'm not the javascript crack, has anyone implemented a solution for
> that or does Trinidad provide another solution?
>                                                                         
> <tr:inputText id="eingabe" label="Präparatename:"
> value="#{productBean.name}" autoSubmit="true"
> partialTriggers="searchCriteria"
> onkeyup="setTimeout(this.onchange,800);" />
>
> Thanks for help,
> Michael
>
>



-- 
Matthias Wessendorf

further stuff:
blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
mail: matzew-at-apache-dot-org

Reply via email to