Atozed Forums

Full Version: TIWEdit and SubmitOnAsyncEvent
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hi,

There is a little problem, I noticed by accident.

Environment:
- Delphi XE5
- Intraweb 15.1.3
- Windows 10
- Browsers: Chrome, FF, Edge

Setting:
TIWEdit
SubmitOnAsyncEvent := False;

It works differently when you press Enter:
If there is only one TIWEdit, the form OnRender event starts
If there is more TIWEdit, the OnRender event for the form will not start.

I've attached the examples.

Regards
brsoft
Hi
The error does not depend on the setting of SubmitOnAsyncEvent property:

" It works differently when you press Enter:
- If there is only one TIWEdit, the form OnRender event starts. (This is not good!)
- If the form has more TIWEdit then OnRender event for the form won't start. (It's okay.)"

The same happens if TIWRegion contains only one TIWEdit.

Surprisingly many problems are caused by this error. Sad
Ive asked Alexandre to look.
I'll test your project and let you know. hold on....
This is not a bug but a standard behavior of HTML forms. In short, whenever a page contains only one input control, the browser will submit once ENTER key is pressed.

Read more about it here:

https://stackoverflow.com/questions/1779...-text-inpu

and here

https://www.philipphoffmann.de/post/brow...-fix-that/
BTW, if you want to prevent this behavior, just add this to your IWEdit's ScriptEvents, OnKeyDown:

if (event.keyCode == 13) {
event.preventDefault();
}
Hi Alexandre,

Did you try the Demo I sent?

To put it another way:
If I press Enter in TIWRegion's only TIWEdit, how do I prevent the entire webpage from reloading? (Do not run the Onrender event.)
In the new IW version (15.1.x), pressing Enter will always work with the OnRender event if there is only 1 TIWEdit in TIWRegion.

Until v15.0.24 there was no such problem.


regards
Hi Alexandre!

I made a simple demo, please take a look!
There are no TIWEdit events in the source code !!!

Submittest application link: http://95.140.46.153/submittest

If you press Enter on the "single TIWEdit / TIWRegion" of the second form, you will return to the previous form.
This operation is not good!

I think the v15.1.x "submitform" has a bug. In v15.0.24 this problem was not yet present.

Comment:
Pressing Enter causes two types of operating problems:
1. If ServerController "Users can start multiple independent sessions in browser tabs" = TRUE, the form will close and return to the previous form.
1. If the ServerController "Users can start multiple independent sessions in browser tabs" = FALSE, the OnRender event of the form starts to work.

I've attached the source code.
I can confirm this application is behaving differently in 15.1 (and it shouldn't, at least regarding that aspect).

I'll have a definitive answer soon.
There is a problem with FormDefaultSubmit() which is not preventing the form submission to happen. It is fixed now and we're building a new update. It should be ready for testing soon.
Pages: 1 2