Skip to Content
0
Former Member
Jun 05, 2008 at 07:34 AM

OnInputProcessing is called twice by using onclick!?

72 Views

Hi,

i ve following situation:

User can press ENTER or click on a button for submit a form. In order to run a javascript before running in oninputprocessing i m using an input field type button and the eventhandler onclick for clicking on the button, for ENTER I m catching the key code.

The problem is now that the oninputprocssing or submit is called twice if an event is fired. However the second time the eventid is empty. And that s the code:

<testscript fore=document event="onkeyupe()" language="JavaScript">

{

myHandler();

}

</script>

<testscript language="JavaScript">

function myHandler(c_id, in_name){

var key_code = window.event.keyCode;

if (key_code == "27"){

document.all.me.click();

} else if (key_code == "13" || c_id == "en"){

if (document.all.cursor_field.value == 'data-sped_date_input') {

var fn = document.all.cursor_field.value;

var x = document.getElementsByName(fn)[0].value;

var y = check_date(x);

if (false == y) {

return;

}

document.getElementsByName(fn)[0].value = y;

}

if (key_code == "13"){

document.forms["myForm"].elements["we_event"].name = 'OnInputProcessing(ENTER)';

}

else {

document.forms["myForm"].elements["we_event"].name = in_name;

}

document.forms["myForm"].submit();

}

}

</testscript>

<input type="button" id="en" onclicke="myHandler('en', 'OnInputProcessing(ENTER)')" name ="Enter" size="02" value="Eingabe" CLASS="btn" />

Any ideas?

Jens