59 Commits

Author SHA1 Message Date
Ben Thomson
a59d3b83eb Code quality clean up (#4449)
Credit to @bennothommo
2019-07-18 08:50:37 -06:00
Luke Towers
6c0a77c064 Fix broken tests 2019-01-10 20:49:15 -06:00
Luke Towers
1c0fd1b419 Yet another change to perfect the getParentForm() method 2019-01-10 18:59:29 -06:00
Luke Towers
39987677f0 Peer review of 1b3263d4c7004c7b036ab8ae8b8fee3cfb6928b5 2019-01-10 17:57:32 -06:00
Luke Towers
1b3263d4c7 Pass the containing Form widget to the FormFields that it generates.
This enables complex FormWidgets that need to know what Form widget they belong to to access that information with $this->formField->form; This also enables a fix for: https://github.com/rainlab/location-plugin/issues/48
2019-01-10 10:22:59 -06:00
fansaien
2dcd84c4f2 Fix the input trigger API where a form element doesn't exist (#4033)
There are no `form` elements in the preview context of a form, so this adds an alternative selector to use when no common `form` elements are found for the Input Trigger API to use. Credit to @fansaien
2019-01-03 16:24:43 -06:00
Szabó Gergő
69988837d5 Fixed readonly on switch and checkbox field types (#3750)
Credit to @gergo85
2018-09-03 14:36:22 -06:00
Nathan van der Werf
8b6f11e6ac Extract child instructions 2018-08-15 19:25:42 +02:00
Nathan van der Werf
a3d7a028b4 Replace is_null with "=== null" comparison 2018-08-15 18:54:46 +02:00
Nathan van der Werf
3a918ad200 Remove "null" assignments 2018-08-15 18:33:24 +02:00
Luke Towers
8df92f4ba1 Merge branch 'develop' of https://github.com/octobercms/october into develop 2018-04-05 22:10:59 -06:00
Luke Towers
5cbadd447a Fix typo in 97e156d43d 2018-04-05 22:10:43 -06:00
Samuel Georges
2164c07616 Preserve multi field types with trigger use
Refs #3195
Refs #2861
Refs https://github.com/daftspunk/oc-test-plugin/pull/41
2018-04-06 10:58:56 +10:00
Samuel Georges
97e156d43d Tidy up logic from #3465, move helper functions out 2018-04-04 14:35:29 +10:00
MartynasJanu
13dadaa667 Set trigger targets arbitrary levels above current form context (#3465)
Fixes #3260. Enables setting the target field for the trigger API to a form context an arbitrary number of levels above the current field by prepending the field name with `^` for each level to go up. For instance, if you had a field [allow_pictures] in the base form and a [records] repeater with [image] fields, and you set the target field for the trigger on [image] to [^allow_pictures] then it would work properly instead of looking for an [allow_pictures] field on the [records] field. Credit to @MartynasJanu. Documented in edc78b584b
2018-03-21 23:25:18 -06:00
Samuel Georges
cd76f2e04f Field definition should override magic 2017-09-13 14:29:42 +10:00
Samuel Georges
18c6bb63a2 API docs progress 2017-03-15 18:03:26 +11:00
Samuel Georges
0d1fc43212 Add isSelected() helper to form field
Fixes an issue where dropdown NULL and 0 are treated as the same
Fixes #2612
2017-02-03 06:35:23 +11:00
Samuel Georges
0b345ad592 Add 'readOnly' spec to form field
Same as disabled except data is still posted back
2016-09-27 16:50:52 +10:00
Samuel Georges
0aef151d9a Add showSearch option to dropdown
This is a highly specific option, so we shouldn't add it to the FormField class itself
2016-03-25 18:21:58 +11:00
Samuel Georges
21f3ac93c1 Add support for HTML comments
Fixes #1808
2016-02-27 09:46:00 +11:00
Samuel Georges
33d39c8b34 Minor 2015-10-17 10:51:54 +11:00
Samuel Georges
f446f8acd4 Merge pull request #1506 from tschallacka/FormFieldCatchForEmptyYaml
Fixed form field parsing to accept no config
2015-10-17 10:23:58 +11:00
Samuel Georges
ef22ac934d DRY up code from #1504 2015-10-17 10:16:49 +11:00
tschallacka
c4fffbd6f7 Fixed form field parsing to accept no config
If a programmer would define a yaml like

    fields:

        shortcut:

        country:

It would fail with message

    "array_key_exists() expects parameter 2 to be array, null given" on line 275 of ..\modules\backend\classes\FormField.php

The yaml parsing returns a null. This check intercepts that null value being passed to the function and turns it into a proper array.
2015-10-09 16:06:23 +02:00
Samuel Georges
37e5b2328f Form text/password/number fields now support maxlength attribute - Fixes #1210 2015-06-20 12:00:37 +10:00
Samuel Georges
7e9e5adfb5 Merge pull request #1032 from keiosweb/fix_hhvm_relation_formfield_issue
fixes HHVM relation formfield
2015-04-01 19:02:08 +11:00
Samuel Georges
c4027b8bc6 Added a defaultFrom option to form fields
Default context of manage and pivot forms is now create and update respectively, instead of the old value relation
2015-03-28 16:14:22 +11:00
Łukasz Biały
e19759c9f9 fixes HHVM relation formfield (belongsToMany in particular) issue in which no data is pulled from relation 2015-03-27 23:03:38 +01:00
Samuel Georges
a743d78658 List Column of type switch now has text-center CSS
List Column now have getName and getId accessors
2015-03-25 19:35:00 +11:00
Samuel Georges
c6bfd5d01c Move this logic to no longer depend on AR model 2015-03-10 09:34:59 +11:00
Samuel Georges
668457b4e6 Updated deprecated references
Str::evalHtmlId -> October\Rain\Html\Helper::nameToId
Str::evalHtmlArray -> October\Rain\Html\Helper::nameToArray
Str::stripHtml -> October\Rain\Html\Helper::strip
Str::limitHtml -> October\Rain\Html\Helper::limit
Str::cleanHtml -> October\Rain\Html\Helper::clean
2015-03-07 12:48:39 +11:00
Samuel Georges
8ca1f8b7a3 Discovered an undoc feature "data-input-preset-prefix-input"... added to API as "prefixInput" 2015-03-07 11:14:03 +11:00
Samuel Georges
69542c311c Form field "preset" options can be a string that just specifies the other field, defaults to url type 2015-03-07 11:02:16 +11:00
Samuel Georges
f8c3eac9c6 Streamline data-input-preset in to FormField API 2015-03-07 10:45:22 +11:00
Samuel Georges
7e3cf98a75 Adds data-trigger-closest-parent to Trigger API
Test code:

<form id="form1">
    <input
        type="text" name="aa" value="aaa"
        data-trigger-action="show"
        data-trigger="input[name=bb]"
        data-trigger-condition="checked"
        data-trigger-closest-parent="form"
     />

    <input type="checkbox" name="bb" />
</form>

<form id="form2">
    <input
        type="text" name="aa" value="aaa"
        data-trigger-action="show"
        data-trigger="input[name=bb]"
        data-trigger-condition="checked"
        data-trigger-closest-parent="form"
     />

    <input type="checkbox" name="bb" />
</form>
2015-03-07 09:47:44 +11:00
Pásztor Gábor
f8cb3900f0 Add validation rules for mail settings. 2015-02-21 19:55:37 +01:00
Samuel Georges
c746ba5c2b Disabled property on form fields should work 2015-02-21 17:09:21 +11:00
Samuel Georges
536a391754 Add basic trigger implementation to Form Field
Implement trigger on Mail Settings page
2015-02-18 18:12:20 +11:00
Samuel Georges
6a2f64757b *** REMOVED ALL DEPRECATED CODE ** 2015-02-14 14:11:25 +11:00
Samuel Georges
03eb949e71 Add illuminate/html package, DB -> Db, HTML -> Html 2015-02-04 20:03:44 +11:00
Samuel Georges
167d113c12 depends -> dependsOn
Hidden fields now retain their container div (hidden when empty)
2015-01-29 20:32:24 +11:00
n.kolesnichenko
3013935374 Bug fix. There is no Aliasing to Model class in FormField class. 2015-01-19 10:47:43 +03:00
Samuel Georges
b74b19741b Unify the logic for getting field values from a dataset
Amongst Form Widgets and "the" Form widget
ping @alekseybobkov
2015-01-05 12:54:14 +11:00
Samuel Georges
ab24c547a2 Move NO_SAVE_DATA to FormField 2014-12-05 16:46:04 +11:00
Sam Georges
f458fb7704 Overhaul Form layouts, adds FormTabs.php class for managing tab properties 2014-11-12 07:33:58 +11:00
Sam Georges
c32ba4cbad Minor code clean 2014-11-04 17:41:48 +11:00
Stefan Talen
7dc24cfff1 Updating backend/classes 2014-10-10 23:12:50 +02:00
Sam Georges
8d5253930d Form fields can now be marked as hidden 2014-10-08 18:55:09 +11:00
Sam Georges
746f425d88 Added new containerAttributes property to form fields 2014-09-25 18:05:35 +10:00