Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
TIWEdit and SubmitOnAsyncEvent
#1
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


Attached Files
.zip   submittest1.zip (Size: 5.48 KB / Downloads: 1)
.zip   submittest2.zip (Size: 5.51 KB / Downloads: 1)
Reply
#2
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
Reply
#3
Ive asked Alexandre to look.
Reply
#4
I'll test your project and let you know. hold on....
Reply
#5
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/
Reply
#6
BTW, if you want to prevent this behavior, just add this to your IWEdit's ScriptEvents, OnKeyDown:

if (event.keyCode == 13) {
event.preventDefault();
}
Reply
#7
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
Reply
#8
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.


Attached Files
.zip   submittest.zip (Size: 7.23 KB / Downloads: 2)
Reply
#9
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.
Reply
#10
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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)