Regexp Custom Field Function

2 views
Skip to first unread message

Phil -- wbtc.fr --

unread,
Oct 10, 2010, 6:08:19 AM10/10/10
to in-por...@googlegroups.com
Hello,

I'd suggest to add a regular expression field in custom field editing
record. When filled, then on forms (where this custom field value is
entered) check would do:
- entered value matches regular expression. If it doesn't match, then
doesn't allow to save custom field value and display an error
OR (with a selector)
- just use provided regular expression to cut part of submitted data

This would mainly be used to let user enter URL or code lines, without
compromising security.

Phil.

Alexander Obuhovich

unread,
Oct 10, 2010, 6:13:14 AM10/10/10
to in-por...@googlegroups.com
- entered value matches regular expression. If it doesn't match, then
doesn't allow to save custom field value and display an error


Could prove to regular users, who don't know PHP and use custom fields.


Maybe we could somehow allow users to modify direct PHP options of each custom field in textarea like this:
required=1
formatter=kDateFormatter
regexp=/^.*$/

or maybe this is too advanced for average users.
--
Best Regards,

http://www.in-portal.com
http://www.alex-time.com

Phil -- wbtc.fr --

unread,
Oct 10, 2010, 6:21:11 AM10/10/10
to in-por...@googlegroups.com
my idea is to have something completly open, where regular users could
helpthemselves with easy expression given as example, while advanced
users would be able to do a serious filtering. May we can think about
this in admin panel, rather than in template?

2010/10/10 Alexander Obuhovich <aik....@gmail.com>:

Alexander Obuhovich

unread,
Oct 10, 2010, 6:25:16 AM10/10/10
to in-por...@googlegroups.com
I was talking only about custom field editing form in admin panel.

Since programming in templates is forbidden, since it mixed business logic with display code.

Phil -- wbtc.fr --

unread,
Oct 10, 2010, 6:29:09 AM10/10/10
to in-por...@googlegroups.com
alright for me, this would be a nice improvment to custom fields,
which makes the versatility power of In Portal.

2010/10/10 Alexander Obuhovich <aik....@gmail.com>:

Dmitry A.

unread,
Oct 17, 2010, 10:35:37 PM10/17/10
to In-Portal Development Team
I think it's quite simple what we are missing with Custom fields.

We need 2 things:


1. Add 2 Validation fields which would hold basic validation options
for Text field:

a. Validation drop-down with basic presets like Email address or
Regular Expression
b. Text field which will be shown only when Regular Expression is
selected and will hold that actual express which will be used for data
entry validation both Admin and Front end.


2. Admin Validation of Custom Field name - when user is defining new
custom field - most of them don't know that Spaces are NOT allowed.
This causing some pain down on the road. Not exactly about what Phil
meant, but kind of related


What you think?


DA.

On Oct 10, 5:29 am, "Phil -- wbtc.fr --" <p...@wbtc.fr> wrote:
> alright for me, this would be a nice improvment to custom fields,
> which makes the versatility power of In Portal.
>
> 2010/10/10 Alexander Obuhovich <aik.b...@gmail.com>:
>
>
>
> > I was talking only about custom field editing form in admin panel.
>
> > Since programming in templates is forbidden, since it mixed business logic
> > with display code.
>
> > On Sun, Oct 10, 2010 at 1:21 PM, Phil -- wbtc.fr -- <p...@wbtc.fr> wrote:
>
> >> my idea is to have something completly open, where regular users could
> >> helpthemselves with easy expression given as example, while advanced
> >> users would be able to do a serious filtering. May we can think about
> >> this in admin panel, rather than in template?
>
> >> 2010/10/10 Alexander Obuhovich <aik.b...@gmail.com>:
> >> > - entered value matches regular expression. If it doesn't match, then
> >> > doesn't allow to save custom field value and display an error
>
> >> > Could prove to regular users, who don't know PHP and use custom fields.
>
> >> > Maybe we could somehow allow users to modify direct PHP options of each
> >> > custom field in textarea like this:
> >> > required=1
> >> > formatter=kDateFormatter
> >> > regexp=/^.*$/
>
> >> > or maybe this is too advanced for average users.
>
> >> > On Sun, Oct 10, 2010 at 1:08 PM, Phil -- wbtc.fr -- <p...@wbtc.fr>

Alexander Obuhovich

unread,
Oct 18, 2010, 2:35:25 AM10/18/10
to in-por...@googlegroups.com
1. Add 2 Validation fields which would hold basic validation options
for Text field:

a. Validation drop-down with basic presets like Email address or
Regular Expression
b. Text field which will be shown only when Regular Expression is
selected and will hold that actual express which will be used for data
entry validation both Admin and Front end.


I agree.


2. Admin Validation of Custom Field name - when user is defining new
custom field - most of them don't know that Spaces are NOT allowed.
This causing some pain down on the road. Not exactly about what Phil
meant, but kind of related

Yes, we should implement sort of validation we are doing with phrase names: only Latin characters and numbers (must start with letter in any case), maybe "_" also should be allowed (since I know, that Phil uses them).

Phil -- wbtc.fr --

unread,
Oct 18, 2010, 4:01:18 AM10/18/10
to in-por...@googlegroups.com
1.
a. ok
b. ok
c. my first idea was to ba able to clean an user entry, for example by retrieving youtube video reference to display it using our own youtube link.

2. yes, and I also got recently the problem with Contact Form fields created in admin. Don't forget to clean all : spaces, accented characters, ^ ? ! and so on...


2010/10/18 Alexander Obuhovich <aik....@gmail.com>

Dmitry A.

unread,
Oct 21, 2010, 12:05:59 AM10/21/10
to In-Portal Development Team
Here is a new task for this:

895: Improvements to Custom Field Validations

http://tracker.in-portal.org/view.php?id=895

DA.

On Oct 18, 3:01 am, "Phil -- wbtc.fr --" <p...@wbtc.fr> wrote:
> 1.
> a. ok
> b. ok
> c. my first idea was to ba able to *clean *an user entry, for example by
> retrieving youtube video reference to display it using our own youtube link.
>
> 2. yes, and I also got recently the problem with Contact Form fields created
> in admin. Don't forget to clean all : spaces, accented characters, ^ ? ! and
> so on...
>
> 2010/10/18 Alexander Obuhovich <aik.b...@gmail.com>
>
>
>
> > *1. Add 2 Validation fields which would hold basic validation options
> > for Text field:
>
> > a. Validation drop-down with basic presets like Email address or
> > Regular Expression
> > b. Text field which will be shown only when Regular Expression is
> > selected and will hold that actual express which will be used for data
> > entry validation both Admin and Front end.*
>
> > I agree.
>
> > *2. Admin Validation of Custom Field name - when user is defining new
> > custom field - most of them don't know that Spaces are NOT allowed.
> > This causing some pain down on the road. Not exactly about what Phil
> > meant, but kind of related*
>
> > Yes, we should implement sort of validation we are doing with phrase names:
> > only Latin characters and numbers (must start with letter in any
> > case), maybe "_" also should be allowed (since I know, that Phil uses them).
>
Reply all
Reply to author
Forward
0 new messages