Search

Hi Guys,

I got a form and there is one field needing a special validation. I added the validation function to my event file.

I can also access the post-data there, but I dont know how to add an additional field/attribute to my xml-output without changing any core files of symphony.

If an error occurs the xml-tree looks like this:

<events>
<specialfrm result="error">
<message>Entry encountered errors when saving.</message>
<articlenumber label="articlenumber" type="missing" message="'articlenumber' is a required field." />
</specialfrm>

it's not possible to change the type because the attributes of the XMLElement are private.

does anyone have an advice to change theese fields or maybe to add an attribute?

is there any function I can use to access the output?

If u say I ll have to use the internal "Validation Rule" in Symphony Backend - thats no option because I have to check the articlenumber through another interface, which runs an oracle db.

best regards wild

it's not possible to change the type because the attributes of the XMLElement are private.

The XMLElementclass has a setAttribute() method which you could use.

Or you could write a basic event filter extension that subscribes to the EventPreSaveFilter delegate. You can do the validation there and also add elements to the event messages. The No Editing of Entries extension would be an example for the latter.

very nice, thx for help

I wrote a small extension - works fine :)

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