Search

Hi all,

I'm a dev and I'm new around.

I wanna know if by using the event engine, it is possible to validate form elements.

I have found a method load() inside the created event php page and with early tests I can avoid calling the __trigger() to avoid saving the entry.


I have a section called Players that contains the login/email of the player.

As this form's validation needs to check if the typed login already exists on an entry of Players, I am wondering what is the best way to query the database?

Note that also, I have hard time to find out how symphony works. As example, is there a global method to test if a field value matches an email ?

Regards,

Validation usually remains at the field level (in your section) and not at the form level (in your event), so think about the problem in terms of the field itself. If you want to enforce uniqueness on an email address, then I suggest the Unique Text Input Field. Validation in Symphony occurs within each field, so using this field means your uniqueness is enforced when entering data both through the backend form and also frontend events.

Sry forgot to say that I was talking about the front-end.

ok tx for info will see what "Unique Text Input Field" does.

I wanted to avoid javascript validation and to make it server side knowing that I have successfully posted an entry from outside the website, that represents a security leak. In "Players" section, there is a field called "role", I have inserted a player with "mod" role, while normally a new registered player shouldn't be a mod.

Questions :

  • So, is there a way to force default values for some fields ?
  • is it possible to totally ignore some fields from the posted forum for security reasons ?
  • Is there a way to change the type of a field on sections without losing data ?
  • How to get filtered datasource result based on an optional selectbox link = null (it works when I filter based on an id value) : I wanna get all entries where no link has been affected?

tx in advance.

So, is there a way to force default values for some fields ?

Not natively. But inside your event PHP you can force field values:

$_POST['fields']['your-field'] = 'your value here';

is it possible to totally ignore some fields from the posted forum for security reasons

Either don't send them in your form post, or use the method above to reset them to a null value in the event.

Is there a way to change the type of a field on sections without losing data ?

That depends ;-) If the field schemas are identical then it might be possible by changing the "type" column in sym_fields, and then moving the rows from the sym_fields_fieldtype1 table to sym_fields_fieldtype2 table. If you're comfortable playing with the database then you could try. Otherwise no.

How to get filtered datasource result based on an optional selectbox link = null

I think the latest version of the SBL field does this (with Symphony 2.2) but someone else might know for sure. Brendan?

tx for help, I have fixed unique issue.

but still, I don't have an answer for this : - How to get filtered datasource result based on an optional selectbox link = null

I have another unsolved issue concerning inserting date :/ I have changed date_format to 'd/m/Y' on manifest/config.php but the value inserted/updated on frontend/backend keeps switching day and months, I haven't found anywhere on code or database where to change it.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details