PDA

View Full Version : DF19: WebForm default piMaxLength is too short



raveens
26-Apr-2017, 06:59 PM
Hi

Using the code below - if you "Click" on the button that populates the FORM

After which you can't edit the form -the default 50 characters for piMaxLength is too short/small.



Object oWebMainPanel is a cWebPanel
Set piColumnCount to 12


Object oForm is a cWebForm
Set psLabel to "test"
Set piColumnSpan to 0
End_Object

Object oButton is a cWebButton
Set piColumnSpan to 2
Set psCaption to "Click"
Procedure OnClick
WebSet psValue of oForm to "Hello World - this is a long string - can you edit me?"
End_Procedure
End_Object

End_Object

Pascal Ried
27-Apr-2017, 02:28 AM
Hey raveens,

For me 50 is fine. But if you want to change it why not create an own cRaveensWebForm superclass with a standard piMaxLength of 100 or 255 (or anything above 50).

As I get it, Forms are not meant to be filled with long text but rather words like names, categories and other data.
Long text is where Edits come in place.

Or is there another problem, I don't see?

Greetings.

Samuel Pizarro
27-Apr-2017, 07:06 PM
I think what he is trying to say is:

you can set the value programmatically by setting the psValue property, but you can't change it by user interface.

raveens
30-Apr-2017, 05:49 PM
The default max length for an input element in a raw HTML form is 512K (524288) - you would assume that if you set the piMaxLength to C_WebDefault that the max length would be somewhere near to this value and not 50 characters. The piMaxLength makes total sense for db aware controls but for non-db aware controls - its almost irrelevant.

The cWebEdit also uses 50 characters as its default ( I think ) - this should at least be 64K (65536) to be compatible with the cTextEdit class.

IMHO, its best to increase the piMaxLength C_WebDefault value in the web controls to more realistic values or maybe a one-size-fits-all of 64K ?

Otherwise, if you set the webform's psValue to a length greater than the current default (50) then the piMaxLength should be increased to the length of the string (if C_WebDefault is used) else you can't edit it.

Harm Wibier
1-May-2017, 03:07 AM
While I agree that the limit of 50 characters is a bit low, especially for the cWebEdit I am a bit hesitant to change that as it would change existing applications (but we will discuss that). We would definitely want to keep it below the argument size.

We could have it clip the value if it overflows the piMaxLenght, but that does have a risk as well as the control then changes the value without user interaction. The current behavior is pretty much the standard behavior of the browser.

Pascal Ried
2-May-2017, 01:46 AM
I agree with Harm Wibier.

Harm Wibier
2-May-2017, 02:15 AM
We have decided to increment the default max length to a pretty high number. This will only affect people that were using cWebForm or cWebEdit without data binding and did not set piMaxLength. If they did not set piMaxLength they most likely do not care. So only the cases where they noticed the default limit of 50 and left it like that will be really affected.

raveens
2-May-2017, 02:40 AM
Thanks, Harm!