Four Js Development Tools Forum

Discussions by product => Genero BDL => Topic started by: Jos? V. on July 19, 2019, 10:07:00 am



Title: PICTURE format not supporting alpha-numeric
Post by: Jos? V. on July 19, 2019, 10:07:00 am
Hello,
I'm trying to define a form field with PICTURE attribute set to alphanumeric chars such as:
Code:
edit  e7 = profor.prfmat , upshift, picture = "AA-AA-AAAA";

But when I try to edit the field I can only insert alpha chars, so digits are not allowed.

Is this a version bug or am I reading the manual wrong?

My version or fglrun is 3.00.04 rev-3be6b8d and GDC is 3.00.04 build-5372.

I also tested with fgl 3.10.14 rev-912632b and GDC 3.10.11 build-158046 and got the same result.




Title: Re: PICTURE format not supporting alpha-numeric
Post by: Bernard M. on July 19, 2019, 10:36:57 am
Hello,

It seems "A" and "X" have been swapped in the documentation.
Try this instead:
Code:
edit  e7 = profor.prfmat , upshift, picture = "XX-XX-XXXX";

We will update the documentation accordingly.

Regards,
Bernard


Title: Re: PICTURE format not supporting alpha-numeric
Post by: Jos? V. on July 19, 2019, 10:55:01 am
I changed from "X" to "A" trying to solve a problem.
So when I read the manual my understanding was:
* X -> Any character(?,/, = etc)
* A -> Only alphanumeric characters.

My problem is X accepts things like linebreaks.
And users are copying cells from excel instead of copying the content of the cell, which then breaks the database because copying the cell carries a linebreak into the field.

The only fields that have this behaviour are field with the PICTURE attribute and TEXTBOX fields.

I was trying and easy fix on the form by using the "A" char on the PICTURE.


Title: Re: PICTURE format not supporting alpha-numeric
Post by: Bernard M. on July 19, 2019, 02:41:08 pm
OK. This is not as simple as it looks.

I don't see any other solution than treat it with 4gl code.
Maybe with ON ACTION dialogtouched to check characters as soon as there is a change in the INPUT field or with AFTER FIELD to test the whole inserted string.

Anyway if you need to treat line breaks this might be even more complicated.

Maybe someone in the forum as already done something like this before.

Regards,
Bernard



Title: Re: PICTURE format not supporting alpha-numeric
Post by: Bernard M. on July 19, 2019, 02:50:40 pm
As an example here a simple test case that might help.

Regards,
Bernard


Title: Re: PICTURE format not supporting alpha-numeric
Post by: Jos? V. on July 19, 2019, 03:29:39 pm
Luckily we don't use that much of textbox or the PICTURE attribute.
We will patch our code to work around this problem as you suggested.
Thank you for your help!


Title: Re: PICTURE format not supporting alpha-numeric
Post by: Sebastien F. on July 19, 2019, 04:17:38 pm
One should not use ON ACTION dialogtouched to control field values:

This special action is provided to detect immediately user input in DIALOG/END DIALOG, to switch the form state from a visualization/navigation mode ("save" action is disabled) to modification mode ("save" action is enabled).

Check: https://4js.com/online_documentation/fjs-fgl-manual-html/#fgl-topics/c_fgl_prog_dialogs_dialogtouched.html

Ideally we could have a new PICTURE placeholder, to allow ONLY letters and digits...

Seb


Title: Re: PICTURE format not supporting alpha-numeric
Post by: Leo S. on July 19, 2019, 05:41:57 pm
Hi Jose, 'A' means any letter. The '(alpha-numeric)' in the doc is simply not correct.
We should update the doc.

Regards, Leo


Title: Re: PICTURE format not supporting alpha-numeric
Post by: Jos? V. on July 22, 2019, 10:44:37 am

Ideally we could have a new PICTURE placeholder, to allow ONLY letters and digits...


This would be perfect for us.