Coder Social home page Coder Social logo

silverstripe / silverstripe-userforms Goto Github PK

View Code? Open in Web Editor NEW
135.0 26.0 227.0 11.96 MB

UserForms module provides a visual form builder for the Silverstripe CMS. No coding required to build forms such as contact pages.

License: BSD 3-Clause "New" or "Revised" License

PHP 71.01% JavaScript 24.91% Scheme 1.39% SCSS 0.91% Gherkin 1.78%
hacktoberfest

silverstripe-userforms's Introduction

UserForms

CI Silverstripe supported module

UserForms enables CMS users to create dynamic forms via a drag and drop interface and without getting involved in any PHP code.

Features

  • Construct a form using all major form fields (text, email, dropdown, radio, checkbox..)
  • Ability to extend userforms from other modules to provide extra fields.
  • Ability to email multiple people the form submission
  • View submitted submissions and export them to CSV
  • Define custom error messages and validation settings
  • Optionally display and hide fields using javascript based on users input
  • Displays a confirmation message when navigating away from a partially completed form.

Installation

composer require silverstripe/userforms

Spam protection

This module does not include spam protection out of the box. Without it, it's likely that your submissions could contain a considerable amount of spam. For public facing forms it is encouraged you review and install the following module plus one of the recommended 'verification system' modules outlined in the README.

Read the SpamProtection Module README for details on how to configure this module.

Documentation

Thanks

I would like to thank everyone who has contributed to the module, bugfixers, testers, clients who use the module and everyone that submits new features.

A big thanks goes out to Jan Düsedau for drawing the custom icon set for the form fields.

Versioning

This library follows Semver. According to Semver, you will be able to upgrade to any minor or patch version of this library without any breaking changes to the public API. Semver also requires that we clearly define the public API for this library.

All methods, with public visibility, are part of the public API. All other methods are not part of the public API. Where possible, we'll try to keep protected methods backwards-compatible in minor/patch versions, but if you're overriding methods then please test your work before upgrading.

Reporting Issues

Please create an issue for any bugs you've found, or features you're missing.

silverstripe-userforms's People

Contributors

3dgoo avatar andrewandante avatar assertchris avatar bergice avatar chillu avatar davidmorrisonnz avatar dependabot[bot] avatar dhensby avatar emteknetnz avatar flashbackzoo avatar fspringveldt avatar github-actions[bot] avatar guysartorelli avatar jyrkij avatar kmayo-ss avatar lukeamos avatar mandrew avatar mateusz avatar maxime-rainville avatar michalkleiner avatar mschilder avatar muskie9 avatar nightjar avatar robbieaverill avatar sabina-talipova avatar sachajudd avatar scopeynz avatar scott1702 avatar undefinedoffset avatar wilr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

silverstripe-userforms's Issues

Cannot Create/Edit NewUserDefinedForm

Hi,

When creating a User Defined Form page, it does not appear directly in the Sitetree. After a refresh of the admin page it does appear. When I want to edit the new created NewUserDefinedForm is does not work. SS 3.0 admin loads for a few seconds but nothing happens.

Dev mode is on, but no error message is displayed. Firebug says: GET 30 Status Aborted.

SS version 3.01
Userforms version: Latest version from GitHub.

Wesley

Bug: Executing only one conditional action for one element

When you define conditional actions in SS there will only be one executed with javascript.

To solve this problem I modified the code as following:

File: userforms/code/model/UserDefinedForm.php
Lines: 638-647

// Register conditional behaviour with an element, so it can be triggered from many places.
                            $rules .= $fieldToWatch.".each(function() {
                                // If a rule is already defined for this element
                                if($(this).data('userformConditions') != null) {
                                        var alreadyDefinedFunction = $(this).data('userformConditions');
                                    }
                                $(this).data('userformConditions', function() {
                                    if(alreadyDefinedFunction != null) {
                                        alreadyDefinedFunction.call(this);
                                    }
                                    if(". $expression ." ) {
                                        $(\"#". $fieldId ."\").".$view."();
                                    }
                                    else {
                                        $(\"#". $fieldId ."\").".$opposite."();
                                    }
                                });
                            });";

"None of these templates can be found in the theme"

SS 3 beta 2. New install. Everything looks ok. Added in the userforms module. Dev/build. Refresh admin page. :

[User Warning] None of these templates can be found in theme '': FieldEditor.ss
GET /admin/pages/edit/show/6

Line 617 in /Users/willbarker/Sites/ss3/framework/view/SSViewer.php

Source

608             $this->chosenTemplates = SS_TemplateLoader::instance()->findTemplates(
609                 $templateList, self::current_theme()
610             );
611         }
612 
613         if(!$this->chosenTemplates) {
614           $templateList = (is_array($templateList)) ? $templateList : array($templateList);
615           
616           user_error("None of these templates can be found in theme '"
617             . self::current_theme() . "': ". implode(".ss, ", $templateList) . ".ss", E_USER_WARNING);
618         }
619     }
620     
621     /**
622      * Returns true if at least one of the listed templates exists
623      */
Trace

None of these templates can be found in theme '': FieldEditor.ss 
SSViewer.php:617
SSViewer->__construct(FieldEditor) 
ViewableData.php:325
ViewableData->renderWith(FieldEditor) 
FieldEditor.php:23
FieldEditor->FieldHolder() 
ViewableData.php:366
ViewableData->obj(FieldHolder,,,1) 
ViewableData.php:443
ViewableData->XML_val(FieldHolder,,1) 
call_user_func_array(Array,Array) 
SSViewer.php:128
SSViewer_Scope->__call(XML_val,Array) 
SSViewer.php:445
SSViewer_DataPresenter->__call(XML_val,Array) 
.cache.framework.templates.forms.TabSet.ss:61
SSViewer_DataPresenter->XML_val(FieldHolder,,1) 
.cache.framework.templates.forms.TabSet.ss:61
include(/private/var/folders/jd/jdarHI-0FSKMFPmiSph-7++++TQ/-Tmp-/silverstripe-cache-Users-willbarker-Sites-ss3/.cache.framework.templates.forms.TabSet.ss) 
SSViewer.php:762
SSViewer->includeGeneratedTemplate(/var/folders/jd/jdarHI-0FSKMFPmiSph-7++++TQ/-Tmp-/silverstripe-cache-Users-willbarker-Sites-ss3/.cache.framework.templates.forms.TabSet.ss,TabSet,,Array) 
SSViewer.php:828
SSViewer->process(TabSet,) 
ViewableData.php:335
ViewableData->renderWith(Array) 
TabSet.php:83
TabSet->FieldHolder() 
ViewableData.php:366
ViewableData->obj(FieldHolder,,,1) 
ViewableData.php:443
ViewableData->XML_val(FieldHolder,,1) 
call_user_func_array(Array,Array) 
SSViewer.php:128
SSViewer_Scope->__call(XML_val,Array) 
SSViewer.php:445
SSViewer_DataPresenter->__call(XML_val,Array) 
.cache.cms.templates.Includes.CMSMain_EditForm.ss:58
SSViewer_DataPresenter->XML_val(FieldHolder,,1) 
.cache.cms.templates.Includes.CMSMain_EditForm.ss:58
include(/private/var/folders/jd/jdarHI-0FSKMFPmiSph-7++++TQ/-Tmp-/silverstripe-cache-Users-willbarker-Sites-ss3/.cache.cms.templates.Includes.CMSMain_EditForm.ss) 
SSViewer.php:762
SSViewer->includeGeneratedTemplate(/var/folders/jd/jdarHI-0FSKMFPmiSph-7++++TQ/-Tmp-/silverstripe-cache-Users-willbarker-Sites-ss3/.cache.cms.templates.Includes.CMSMain_EditForm.ss,Form,,Array) 
SSViewer.php:828
SSViewer->process(Form,) 
ViewableData.php:335
ViewableData->renderWith(Array) 
Form.php:1234
Form->forTemplate() 
ViewableData.php:444
ViewableData->XML_val(EditForm,,1) 
call_user_func_array(Array,Array) 
SSViewer.php:128
SSViewer_Scope->__call(XML_val,Array) 
SSViewer.php:445
SSViewer_DataPresenter->__call(XML_val,Array) 
.cache.cms.templates.Includes.CMSMain_Content.ss:85
SSViewer_DataPresenter->XML_val(EditForm,,1) 
.cache.cms.templates.Includes.CMSMain_Content.ss:85
include(/private/var/folders/jd/jdarHI-0FSKMFPmiSph-7++++TQ/-Tmp-/silverstripe-cache-Users-willbarker-Sites-ss3/.cache.cms.templates.Includes.CMSMain_Content.ss) 
SSViewer.php:762
SSViewer->includeGeneratedTemplate(/var/folders/jd/jdarHI-0FSKMFPmiSph-7++++TQ/-Tmp-/silverstripe-cache-Users-willbarker-Sites-ss3/.cache.cms.templates.Includes.CMSMain_Content.ss,CMSPageEditController,,Array) 
SSViewer.php:828
SSViewer->process(CMSPageEditController,) 
ViewableData.php:335
ViewableData->renderWith(Array) 
LeftAndMain.php:524
LeftAndMain->Content() 
ViewableData.php:366
ViewableData->obj(Content,,,1) 
ViewableData.php:443
ViewableData->XML_val(Content,,1) 
call_user_func_array(Array,Array) 
SSViewer.php:128
SSViewer_Scope->__call(XML_val,Array) 
SSViewer.php:445
SSViewer_DataPresenter->__call(XML_val,Array) 
.cache.framework.admin.templates.LeftAndMain.ss:40
SSViewer_DataPresenter->XML_val(Content,,1) 
.cache.framework.admin.templates.LeftAndMain.ss:40
include(/private/var/folders/jd/jdarHI-0FSKMFPmiSph-7++++TQ/-Tmp-/silverstripe-cache-Users-willbarker-Sites-ss3/.cache.framework.admin.templates.LeftAndMain.ss) 
SSViewer.php:762
SSViewer->includeGeneratedTemplate(/var/folders/jd/jdarHI-0FSKMFPmiSph-7++++TQ/-Tmp-/silverstripe-cache-Users-willbarker-Sites-ss3/.cache.framework.admin.templates.LeftAndMain.ss,CMSPageEditController,,Array) 
SSViewer.php:828
SSViewer->process(CMSPageEditController,) 
ViewableData.php:335
ViewableData->renderWith(SSViewer) 
LeftAndMain.php:426
{closure}() 
call_user_func(Closure) 
PjaxResponseNegotiator.php:57
PjaxResponseNegotiator->respond(SS_HTTPRequest) 
LeftAndMain.php:407
LeftAndMain->show(SS_HTTPRequest) 
Controller.php:195
Controller->handleAction(SS_HTTPRequest) 
RequestHandler.php:168
RequestHandler->handleRequest(SS_HTTPRequest,DataModel) 
Controller.php:149
Controller->handleRequest(SS_HTTPRequest,DataModel) 
LeftAndMain.php:332
LeftAndMain->handleRequest(SS_HTTPRequest,DataModel) 
Director.php:257
Director::handleRequest(SS_HTTPRequest,Session,DataModel) 
Director.php:99
Director::direct(/admin/pages/edit/show/6,DataModel) 
main.php:128

UserForms 0.5 not SS2.4 compatible

In README.md it states that the 0.5 branch is for SilverStripe 2.4.6+ but there are several references to GridField in the code, and therefore it doesn't work with my SS2.4 install. What branch is SS2.4 compatible?

Validation of a file upload field doesn't work

Checking the « mandatory » option and adding a custom error message for a file upload field has no effect : on the front-end, the form can be submitted and no errors are displayed if the user doesn't provide a file to upload.

Export of Submission doesn't work for large number of submissions

When exporting from submissions for a form with 3500+ submissions, I get a Server Error 500. The server logs show the below error:

[Wed Nov 14 10:15:44 2012] [error] [client 150.101.154.148] Premature end of script headers: php-handler
[Wed Nov 14 10:16:34 2012] [error] [client 150.101.154.148] Premature end of script headers: php-handler

Hoping to number submissions

I've been asked to number the submission in SubbmittedFromReportFields.ss. It seems like the
Viewing rows $Submissions.Start - $Submissions.StartPlusOffset of $Submissions.TotalCount rows might hold the key, but I'm in over my head. Is there an easy way to do it?

Many thanks!

Martin

Page type is not shown in backoffice

I am using the silverstripe 3.02, i have a folder like userforms in the root. I made a dev/build and then, after the build, in the admin i don't see the page type User Defined Form.

In the first installation i get the correct page type but i had issues to add the form field, then i deleted the folder of the root and i made a new dev/build. Now i want to try new versions of the module and I never get the page type defined in the admin area.

error creating feild

I have upgraded my user forms module from 0.3 to 0.4.

I am running ss 4.7.

After upgrading from 0.3 to 0.4 get an error when adding a new field in form tab. The erro is in green but says "error creating field"

I have tired running the /dev/tasks/UserFormsMigrationTask, but it tells it doenst exist.

Any idea whats going wrong?

Thanks in advance

Form edit/create will not work (in SS3.0.3) if theme still set to default

Using SilverStripe-cms-v3.0.3 and userforms-0.4-90 (latest versions at time of writing), installed and the Form field was empty / blank. Switched on dev mode and caught this error:
SSViewer.php line 670: None of these templates can be found in theme ''

I then went to to admin->Settings and changed Theme from "default theme" to "simple" - aka the default theme - and after running ?flush=1 the Form started to work.
Tim, Bath, UK

Allow the use of custom form classes on user defined form pages.

Currently, the behaviour of a user defined form, and the generation of the form itself, is all hard-coded into the UserDefinedForm_Controller page type.

This means that if you want to make any kind of non-standard functionality, you often have to throw away UDF and make a custom form class instead. This is a problem.

A better architecture would be to allow the insertion of custom form classes into a UDF page. The way that this would work is the UDF page would instantiate the given form class, and inject its own user-defined fields into the that form object.

The goal of this would be to let developers build a custom form class that had, for example, a different action handler. A good way of judging the architecture would be to look at several forms on previous sites that, for whatever reason, were build without using UDF. Why were the build this way, and would this feature help?

UploadField, when created in Page.php, displays incorrectly in UDF.

Screenshots:
http://prawnstar.net/other-stuff/imageupload.png
http://prawnstar.net/other-stuff/pop-up.png

Steps to reproduce the issue

Step 1. Create an UploadField in Page.php

public static $has_one = array('BannerImage' => 'Image',);

public function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Banner', $image = new UploadField('BannerImage', 'Banner'));
$image->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif'));
return $fields;
}

Step 2. install UDF module (using current master)

Step 3. From "Files" section of CMS add some images to test with.

Step 4. Create a UDF page by either changing the default page type of an existing page or adding a new UDF page.

Step 5. From the "Banner" tab you created in step 1, try to add an image from the File Store.

Oddly enough, even though the popup fields are labeled incorrectly and no thumbnail is showing, you can select a blank fields and insert an image. You just don't know which image you are inserting.

'Hide' custom rule can be circumvented

  • Set a custom rule to show a hidden-by-default dropdown field depending on the choice of a preceding dropdown field.
  • Then add a third hidden field (text or another) which depends on the choice given to the second one to show or not.
  • Make the appropriate choice in the first dropdown field to show the second one, then again choose for the third field to show.
  • Change the choice of the first field: the third one is still there.

SSW viewer error in admin

Installed and dev build completed sucessfully
in admin if i create or change a page to a user defined form it created a page but i get an error.

warning at line 663 or home/sitename/public_html/framework/view/SSViewer.php

Silverstrtripe 3.01

Fix EditableFileField to allow customized file extensions

Currently no nice way to extend the default file extensions. A public array exists in the EditableFileField but never is applied to the form field.

Allowed extensions should probably be in the cms as a comma separated list (with the standard defaults).

Fix usability of the HTML block.

Users are confused about labels vs the content (under options), also you can do more than just html so perhaps we rename to InformationBlock which allows HTML input.

How it looks currently:
image

DateField dateformat ignored by IE

The jQuery UI date picker for DateFields is working as expected with the following exception: IE 7, IE 8 and IE 9 are ignoring the dateformat setting and selecting dates result in the following US format: 12/23/2012. This fails to validate upon submit. Have tested in other browsers and the dateformat is entering correctly: eg 23 Dec 2012.

I have tried stripping out all other JS from the template as a basic test and problem persists.
I have tried setting the dateformat config for the DateField manually, and problem persists.
I have tried setting the DateField locale manually, and problem persists.
I have tried setting the DateField::set_default_config('dateformat'), and problem persists.
I have confirmed i18n::set_locale('en_GB').

Having tried all above, I cannot locate the problem, and have reverted to using a simple text field in place of the date field.

Create an Insert Form TinyMCE button rather then $UserForms var

In the latest userforms, I noticed that it has $userforms in the content field when you load the page. Strange! I thought it was some sort of error, but turns out it actually has a meaning and puts the Userform in the content section rather than in $Form. This is really strange and I dont think it is a good idea. What average CMS editor is going to understand something as esotheric as that.

I had two userforms. In one of them I deleted it and in the other I did not. I ended up with completely different forms (css applied differently).

I can provide lots of reasons why we should remove this feature, but I would like to see first what the idea is as to not to waste your time.

Option for required field only when visible

Feature Request:

In my case, sometimes I have a checkbox or drop-down that asks the user to make a choice, depending on what they choose, I show a different set of fields. It would be great if I could make fields required only when visible.

Appending "/finished" to the end of the form link bypasses the form altogether.

The on complete webpage is accessible by appending "/finished" to the end of the form link, this allows the users to bypass the form altogether.

I am currently using the form to gather user information before allowing that user to download any software from the on complete page, however they can bypass the form by simply appending "/finished" to the end of the form link.

Ability to submit the form via AJAX

Flag under form option. Response should replace the form: if successful and fire a custom event if project specific code needs to be triggered.

Userform v0.5 & Master: Issue Adding Fields with SilverStripe v.3.0.0

Hi,

I am having a problem with the userform module (tried with both version 0.5 and Latest master build from Git) on SilverStripe 3.

When I use userform v0.5 --> nothing happens and cannot even display the page after I set page as a user defined form page.
When I use latest master build that I downloaded from git (04 July 2012) --> it is much better but I cannot add any form field.

When I go to create fields, I get a blank white screen (the URL of this page is /admin/pages/edit/show/108) and nothing happened.
I tried both /dev/build and /admin?flush=all after I installed this module.

One thing I noticed from latested module is that in the configuration file (_config.php) it is referencing FieldEditor.js from Javascript folder.

LeftAndMain::require_javascript('userforms/javascript/FieldEditor.js');
LeftAndMain::require_css('userforms/css/FieldEditor.css');

However, in the actual Javascript folder only have one file - "UserForm.js"
--> I tried to rename UserForm.js to FieldEditor.js but no luck.
also tried to change the path of the file, but again I had no luck.

Could anyone help me to resolve this issue?

Thanks in advance for your help.

Tab "Form" doesn't have any content

Hello there,

this is my first time testing some modules for my silverstripe installation.

I did follow installation instructions from readme file and assigned the type of a page with this module already.

Now, if I click on the "Form" tab, it doesn't show the form builder. I can't find any errors (browser nor apache error.log)

Are both versions still compatible?

Best Regards
squareZ

Have the page reload to the #form_id or wrapper rather than top of page

If you have a form that doesn't fit above the fold on a monitor, when the form is submitted, the page loads back at the top.

A user would have to scroll down to see the confirmation message that appears confirming the form has been sent, or any errors in the form if javascript is disabled.

I think it should work like page comments module which brings the user back to that area on the page, since comments are always on the bottom.

I realize this probably isn't an issue for most forms, but I just built a site where this issue popped up because the form is below the fold because of other text on the page.

iframe removes userform

SS3, when adding an iframe to a userforms page, the form no longer appears. is there a workaround?

And/Or in custom rules

It would be very usefull if one could relate multiple custom rules as AND or OR to eachother, like:

'Show This Field' When 'Field A' Is 'Not Blank'
'AND'
('Show This Field') When 'Field B' Is 'Value' 'Information'
or

'Show This Field' When 'Field A' Is 'Blank''
'OR'
'Hide This Field' When 'Field B' Is 'Not Value' 'Information'
With AND-relations the second, third etc Show/Hide? This Field-field could better be greyed out

"Select a Form Field to use as the From Address" setting being ignored (db38ca8 dev-master)

Recently (composer) updated the userforms module to db38ca8 from dev-master.

UserForms is set up to email the submission to various recipients with the "Select a Form Field to use as the From Address" selected from one of the input fields (Email field).

Prior to the update, when a form was submitted, the From field of the email was populated properly.

Now, it appears to not set the "From" field and only set the "Reply-To" field.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.