Code Monkey home page Code Monkey logo

kirby-dreamform's Issues

Edge cases when using multiple forms on the same page

If I am not missing the obvious and that’s already possible — it would be nice if the page scrolls to the form and/or the error-/success-messages after submit. Otherwise it’s easy to miss submission errors (on longer pages where the form is further down).

Obviously this would be easy with a #-link, but I have no idea how to implement this, and hardcoding an URL is not an option.

Whitespace in field label spans

On a regular text field there is whitespace before and after the actual text, which can lead to styling problems:

<span>
		Termin	</span>

Select fields do not retain their values on page reload when form does not validate

When trying to submit a form that does not validate, the page gets reloaded showing an error message. If I have selected an option from a select-field before submitting, my choice gets lost and I have to select the desired option again.

The expected result would be for the option to be remembered and kept until the form is successfully submitted.

As a sidenote: is there a special reason why the required-attribute is not inserted in required fields? This would add an extra-validation layer before submission and is supported by virtually all modern browsers.

Empty referer crashes page

Sorry but after solving #23 I run into the next breaking error. Somehow my referer seems to be null while the function expects a string?

TypeError thrown with message "tobimori\DreamForm\DreamForm::findPageOrDraftRecursive(): Argument #1 ($path) must be of type string, null given, called in /Users/thguenther/Arbeit/Projekte/VerlageGegenRechts/site/plugins/kirby-dreamform/classes/Models/SubmissionPage.php on line 41"

Stacktrace:
#10 TypeError in /Users/thguenther/Arbeit/Projekte/VerlageGegenRechts/site/plugins/kirby-dreamform/classes/DreamForm.php:180
#9 tobimori\DreamForm\DreamForm:findPageOrDraftRecursive in /Users/thguenther/Arbeit/Projekte/VerlageGegenRechts/site/plugins/kirby-dreamform/classes/Models/SubmissionPage.php:41
#8 tobimori\DreamForm\Models\SubmissionPage:findRefererPage in /Users/thguenther/Arbeit/Projekte/VerlageGegenRechts/site/plugins/kirby-dreamform/classes/Actions/EmailAction.php:153
#7 tobimori\DreamForm\Actions\EmailAction:templateValues in /Users/thguenther/Arbeit/Projekte/VerlageGegenRechts/site/plugins/kirby-dreamform/classes/Actions/EmailAction.php:181
#6 tobimori\DreamForm\Actions\EmailAction:subject in /Users/thguenther/Arbeit/Projekte/VerlageGegenRechts/site/plugins/kirby-dreamform/classes/Actions/EmailAction.php:208
#5 tobimori\DreamForm\Actions\EmailAction:run in /Users/thguenther/Arbeit/Projekte/VerlageGegenRechts/site/plugins/kirby-dreamform/classes/Models/FormPage.php:284
#4 tobimori\DreamForm\Models\FormPage:submit in /Users/thguenther/Arbeit/Projekte/VerlageGegenRechts/site/plugins/kirby-dreamform/classes/Models/FormPage.php:325
#3 tobimori\DreamForm\Models\FormPage:render in /Users/thguenther/Arbeit/Projekte/VerlageGegenRechts/kirby/src/Cms/App.php:775
#2 Kirby\Cms\App:io in /Users/thguenther/Arbeit/Projekte/VerlageGegenRechts/kirby/src/Cms/App.php:1189
#1 Kirby\Cms\App:render in /Users/thguenther/Arbeit/Projekte/VerlageGegenRechts/index.php:5
#0 require in /Applications/Herd.app/Contents/Resources/valet/server.php:151

Undefined variable $append

When using Kirby's cache and something other than the api mode I get this error when submitting forms:

Whoops\Exception\ErrorException thrown with message "Undefined variable $append"

Stacktrace:
#6 Whoops\Exception\ErrorException in /Users/thguenther/Arbeit/Projekte/VerlageGegenRechts/site/plugins/kirby-dreamform/classes/Models/SubmissionPage.php:273
#5 Whoops\Run:handleError in /Users/thguenther/Arbeit/Projekte/VerlageGegenRechts/site/plugins/kirby-dreamform/classes/Models/SubmissionPage.php:273
#4 tobimori\DreamForm\Models\SubmissionPage:redirectToReferer in /Users/thguenther/Arbeit/Projekte/VerlageGegenRechts/site/plugins/kirby-dreamform/classes/Models/FormPage.php:368
#3 tobimori\DreamForm\Models\FormPage:render in /Users/thguenther/Arbeit/Projekte/VerlageGegenRechts/kirby/src/Cms/App.php:775
#2 Kirby\Cms\App:io in /Users/thguenther/Arbeit/Projekte/VerlageGegenRechts/kirby/src/Cms/App.php:1189
#1 Kirby\Cms\App:render in /Users/thguenther/Arbeit/Projekte/VerlageGegenRechts/index.php:5
#0 require in /Applications/Herd.app/Contents/Resources/valet/server.php:151

I'd suggest the following change:

return  $kirby->response()->redirect(
-  ($this->referer() ?? $this->site()->url()) . isset($append) ? $append : ''
+ ($this->referer() ?? $this->site()->url()) . (isset($append) ? $append : '')
);

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.