Default Event Values
This is an open discussion with 43 replies, filed under Extensions.
Search
Wow, cool idea. This will probably eliminate the only source of actual php code in my projects now. Nice job :)
Very cool, Brendo! This will really reduce the number of custom events to write and maintain.
May I ask if you see a chance to integrate the MAX_FILE_SIZE
value somehow? This value can be set in a form as a hidden value, but it would be great to be able to set it as a default event value as well.
Hmmm, this might as well be true for other (custom) hidden fields. So it would be super-cool to have "custom" fields in this extension. The developer might set the name and the value.
May I ask if you see a chance to integrate the MAXFILESIZE value somehow
This is the first thing I remove from form HTML, instead I add this to my .htaccess
.
Yeah, but setting this on a per-event basis would be really cool. You might have frontend forms for big files in certain sections, still setting the other sections to reasonable values.
Nice one, the more we forget about php, the better :)
Awesome idea!
Nice one, the more we forget about php, the better :)
I find that funny :)
Thanks for the feedback.
I'm currently working on some improvements to allow you to sent any form value, which will allow MAX_FILE_SIZE
and things like the send-email
filters to be set using this extension, which is a big win for security
Default Event Values
updated to version 0.4
on 6th of June 2011
- Update to support custom values, please note that array support isn't there yet (ie. you can't sent send-mail filters or anything that is
array[key]
)
That is fantastic! I will check it out today! At the moment I do not need array support for field names, so it might be simply perfect.
There's a couple of show stopping bugs with the custom value implementation at the moment, so just hang tight today while I sort a couple out :)
Default Event Values
updated to version 0.5.1
on 8th of June 2011
0.5 (8th June 2011)
- Custom Values now correctly override or work as defaults (both Event Editor and Frontend wise)
- Fixed nasty error for creating new events (thanks alpacaaa)
I'd love to get this field working in my 2.2.5 install. I'm using 0.5.1 of the extension. Saved an event with two defaults: {$ds-project-view-individual} and {$ds-logged-in-member}. When I try to save the event now I get these errors:
Entry encountered errors when saving. 'Project Link' is a required field. 'Organization Link' is a required field.
Event was working fine when I had these values in the HTML. I checked the event php and they got added just fine:
public $eDefaultValues = array( "project-link" => array( 'value' => '{$ds-project-view-individual}', 'override' => 'yes', ), "organization-link" => array( 'value' => '{$ds-logged-in-member}', 'override' => 'yes', ), );
Am I missing something? the idea behind this extension seems so simple? What else could I check?
Finally read the above line enough times before I figured it out:
Values can be page parameters, excluding Datasources though as Events run before Datasources.
Bummer. Is there a way I could load a param in more permanently to use it here?
Run the two datasources inside the event, before it executes.
$datasources = 'project_view_individual,logged_in_member'; $xml = new XMLElement('root'); $page = Symphony::Engine()->Page(); $page->processDatasources($datasources, $xml); $env = $page->Env(); die(var_dump($env));
Hey thats cool. Do they datasources technically run twice? Probably not that big of deal though?
Yep they'll run twice, but queries are cached so I think you won't even notice the difference.
I was about to ask the same question with a frown, but I completely forgot about caching. Yes, the extra overhead would be negligible indeed!
Great idea there Marco!
Hi brendo, I just started using your "default event values" extension. And it's working great, thanks for creating this. I'm using it to provide overriding default values for a number of the event parameters, so dont have to include those in the form fields, which is really nice because it's enforcing the intent of the event declaratively on the backend rather than spreading into the front end code.
I've got a question about events... when one creates an event it is associated with a section and provides the ability to update any section entry field... what's the best way to restrict which fields the event is actually allowed to update, and/or when an update or insert will be allowed at all? (Beyond, the event access control that the Members extension provides)
I'm betting one answer will be customizing the event code. But it's hard to figure out exactly how do this, hard to find good examples. Also wondering if this has been solved by any extensions that I'm not aware of.
@jeffstrt
Members
is the correct answer. I opened an issue asking for section level permissions. You might give it a vote.
Until that feature is implemented, customizing the Event is the only way.
Create an account or sign in to comment.
A new extension, "Default Event Values" is now available for download. Comments and feedback can be left here but if you discover any issues, please post it on the issue tracker.
Default Event Values
Adds the ability to default values for your Events. This allows you to set a field's value while omitting the hidden field from your form markup. Values can be page parameters, excluding Datasources though as Events run before Datasources. You currently cannot set a default value for the ID of an Event due to a Symphony limitation.
Values can be added as defaults, which can be overridden by users, or can be made to override any value that is posted via the Frontend. Please note that other extensions that use the EventPreSaveFilter may change the values after this extension has done it's business.
How do I use it?
Extract and install this extension to your
/extensions
folderWhile creating your events in the Event Editor, a new duplicator will appear after the Filter Options settings.
Save your event as normal and take a tequila shot, because tonight's going to be a good night.
Things to be aware of
post-values
Event XMLsend-mail[sender-email]
, but it is planned.What's changed?
0.4 (6th June 2011)