Hi designers,
have a web form with one input field and a drop down list. This list is filled by a dblookup from the input field - when the user presses a button . This button does nothing else than @Command([ViewRefreshFields])
Works fine.
But if the user pressed the return key (as long as the cursor is in the input field), I get a “form processed” message (nothing is saved, because “SaveOptions” = 0).
How can I avoid this… or better: how can I “redirect” the return key to the button command?
I could do sth like
“onKeyDown” property of the input field and
if (event.keyCode == 13)…
but isn’t there a much simplier way??
thanks for bringing me back… I think I’m just blind at the moment…
Uwe
"
Subject: must be simple…: I do NOT want a submit in the browser if I press the return key
use the onSubmit() event with a variable.
In the JS Header:
var notSubmitting = true;
In the onSubmit function
if(notSubmitting){
// Tell the form we are just refreshing
document.forms[0].__Click.value = “$Refresh”;
}
else{
// all your normal form submit (if any)
}
Then in your submit button, set notSubmitting to false so that it will submit correctly if your even doing this.
Subject: and to clarify
If this form is never used to store data on the server and only for display purposes, just put:
document.forms[0].__Click.value = “$Refresh”;
in your onSubmit()
This way, any attempts to submit the form (to include pressing the return/enter key will act as a Refresh Fields
Subject: thanks
I will place the code tomorrow - and will give feedback 
Uwe
Subject: must be simple…: I do NOT want a submit in the browser if I press the return key
No, there is no simpler way. You’ll need to create an onkeypress event handler to intercept the enter key.