Comments (2)
>addCondition(~Forms\Form::EQUAL, [])
should be always evaluated as false. Isn't it?
from forms.
Hi David,
yes is it...
Look the full example below for test and see my code comment
protected function createComponentForm()
{
$form = new Nette\Application\UI\Form;
$form->addSelect("namespace", "Namespace:", [1 => "first", 2 => "second"])
->setPrompt("---");
$form->addSelect("reason", "Reason:", [1 => 1, 2 => 2, 3 => 3, 4 => 4])
->setPrompt("---");
$form->addText("from", "From:");
$form->addText("to", "To:");
$form["reason"]
->addConditionOn($form["namespace"], Form::EQUAL, 1)
->addCondition(~Form::EQUAL, [3, 4])
->toggle("from")
->endCondition()
->endCondition()
->addConditionOn($form["namespace"], Form::EQUAL, 2)// if I will remove this condition, below condition functionality are ok
->addCondition(~Form::EQUAL, [])// if array empty, condition still false... if array have some value, functionallity are ok
->toggle("to")
->endCondition()
->endCondition();
return $form;
}
{layout none}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<script src="{$basePath}/js/netteForms.js"></script>
</head>
<body>
{form form}
<div id="namespace">
{label namespace /} {input namespace}
</div>
<hr>
<div id="reason">
{label reason /} {input reason}
</div>
<hr>
<div id="from">
{label from /} {input from}
</div>
<hr>
<div id="to">
{label to /} {input to}
</div>
{/form}
</body>
</html>
from forms.
Related Issues (20)
- Number type input validation problem if number type input depends on other input
- Create n:name tag/macro form in Latte 3 directly in HTML <form> tag
- Use constructor of mapped type with readonly parameters HOT 1
- Missing line for getLabel() in compiled templates HOT 2
- SubmitButton without caption throws depracated error on render on PHP 8.1
- UploadControl MaxLenght message %i HOT 1
- private const Array (request to change to public)
- Validation problem with rule MIME_TYPE
- Unable to add class to input programatically when rendered using n:name
- netteForms.js doesn't toggle properly when form is reset
- Cannot call method startTag() / endTag() on string
- addDate(), addTime(), addDateTime() - how to get nullable values?
- netteForms: min/max wrong validation of numbers HOT 1
- setValue() as well as setDefaultValue() don't set the value and the field shows error states instead HOT 2
- ChoiceControl::getRawValue(): Return value must be of type string|int, null returned HOT 1
- Validation of MimeType rule fails when FileControl->getContentType returns null HOT 1
- src/assets/netteForms.js broken in 3.2-dev HOT 1
- `Nette\Forms\Blueprint::dataClass($form)`: Undefined variable `$bp` HOT 1
- Number inputs format shouldn't be always validated HOT 7
- Number input with maxlength validation always fails HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from forms.