Project

General

Profile

Actions

Feature #17542

closed

Conditional Requirment for Fields in BE-Forms

Added by Malte Jansen over 16 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Should have
Category:
-
Target version:
-
Start date:
2007-08-20
Due date:
% Done:

0%

Estimated time:
PHP Version:
5.1
Tags:
Complexity:
Sprint Focus:

Description

I'm searching for a solution of following Problem and have naothing found until now:

Problem 1:
Fields (input,Text,Date,Selectbox,) should only be required if a Checkbox/Input-/Date-Field is set or not empty.

Problem 2:
At least one Field (Checkbox/Input-/Date-Field) is required/not empty of a List of Fields.

Example:
--div--;Concat Information, ...Some fields like Name...,
--div--;Further Information 1,activation1(Checkbox or Date),input_field(required if actionvation1 is not empty), ,...,
--div--;Further Information 2,activation2(Checkbox or Date),input_field2(required if actionvation2 is not empty), ,...,

At least on of die activation-fields should be checked.
(issue imported from #M6173)


Files

Actions #1

Updated by Malte Jansen over 16 years ago

After some work, I have found a solution for this problem.

I have added some documentation in the ReadmeFirst.txt

Following Bugs are also solved:
- 0006259
- 0006256

I used the patch of bug 0005899.

All Bugs/Features are improvments for the editors. So it makes sense to put them in to one patch.

Actions #2

Updated by Andreas Otto † over 16 years ago

Malte,

can you please submit your patch in the unified diff format [1].

[1] http://typo3.org/development/bug-fixing/diff-and-patch/

Cheers,
Andreas

Actions #3

Updated by Malte Jansen over 16 years ago

Hi Andreas,

I would do it, but there is the template.php which I cannot compare against the Repository, because of error during creating the diff.

I think I have to create the file again.

Perhaps you have more luck with creating the patch. The files are from Version 4.1.2. You can copy them in into your version.
Next week I have time to update it.

Next week I think that I will finsh the developing the input field as conditional-field. now it only works with checkboxes.

Actions #4

Updated by Malte Jansen over 16 years ago

I have developed a new version which is much easier to use.
You only have to extend the eval-value with the condition. But you still have to use the required.

Example:

"tca.php"
...
"my_field" => Array (
"exclude" => 1,
"label" => "LLL:EXT:my_ext/locallang_db.xml:tx_myext_table.my_field",
"config" => Array (
"type" => "input",
"size" => "20",
"eval" => "required,condition[some_condition],trim",
)
),
...

"some_condition"
- "field": checkbox must be activeted for being required
- "!field": checkbox must be deactiveted for being required
- "field1&field2": both checkboxes must be activated for being required
- "field1|field2": at least one checkbox must be activated for being required
- "[field1&field2]|field3" = "field1&field2|field3": ...
- "some_condition|some_condition": ...
- ...

Tested with single-checkbox & input-field as conditional-field and input-field as required-field.

TODO:
- Using any value instead of empty & filled (e.g.: condition[field:value])
- Add single-checkbox as required-field
- Add multiple-checkbox as conditional-field
- Add radio-button as conditional-field

Actions #5

Updated by Malte Jansen over 16 years ago

Version 4
Here is Syntax:
<bool> = ! | empty
<fieldname> = any field name (fieldtype must be: input,radio,check,text)
<fieldvalue> = [a-zA-Z0-9\w] (fieldtype:input|text)
<itemnumber> = [0-9] (fieldtype:check|radio)
<value> = empty | <fieldvalue> | <itemnumber>
<field> = <bool><fieldname>[;<value>]
<and> = <check>&<check>
<or> = <check>|<check>
<check> = \[<field> | <and> | <or> | <check> \]

if you leave the value empty it only checks wheater the field is not empty (input/text) or the first item is checked/true (radio/check)

There is no loop-check! So test your condition on loops!
Example:
Field1 is required when Field2 is filled and Field2 when Field1 is filled.

It would be nice to get some feedback...

Actions #6

Updated by Malte Jansen over 16 years ago

This bug can be closed.

There is now the extension:

maja_conditions

If the is feedback, than this extension could be merged with the core.

Actions #7

Updated by Christian Jul Jensen over 15 years ago

See comment

Actions #8

Updated by Benni Mack over 5 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF