-
-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BaseControl: added 'form' attribute [WIP]
- Loading branch information
Showing
5 changed files
with
108 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Nette\Forms\Form; | ||
use Tester\Assert; | ||
|
||
require __DIR__ . '/../bootstrap.php'; | ||
|
||
|
||
$form = new Form; | ||
$form->getElementPrototype()->id = 'frmid'; | ||
|
||
$form->addText('a'); | ||
$form->addTextArea('b'); | ||
$form->addDate('c'); | ||
$form->addUpload('d'); | ||
$form->addHidden('e'); | ||
$form->addCheckbox('f'); | ||
$form->addRadioList('g', null, ['item']); | ||
$form->addCheckboxList('h', null, ['item']); | ||
$form->addSelect('i'); | ||
$form->addMultiSelect('j'); | ||
$form->addColor('k'); | ||
$form->addSubmit('l'); | ||
$form->addButton('m'); | ||
$form->addImageButton('n'); | ||
$form->addHidden('none')->setHtmlAttribute('form', false); | ||
$form->addHidden('diff')->setHtmlAttribute('form', 'different'); | ||
|
||
Assert::matchFile(__DIR__ . '/expected/Forms.form.expect', $form->__toString(true)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<form action="" method="post" id="frmid" enctype="multipart/form-data"> | ||
|
||
<table> | ||
<tr> | ||
<th><label for="frm-a"></label></th> | ||
|
||
<td><input type="text" name="a" id="frm-a" form="frmid" class="text"></td> | ||
</tr> | ||
|
||
<tr> | ||
<th><label for="frm-b"></label></th> | ||
|
||
<td><textarea name="b" id="frm-b" form="frmid"></textarea></td> | ||
</tr> | ||
|
||
<tr> | ||
<th><label for="frm-c"></label></th> | ||
|
||
<td><input type="date" name="c" id="frm-c" form="frmid"></td> | ||
</tr> | ||
|
||
<tr> | ||
<th><label for="frm-d"></label></th> | ||
|
||
<td><input type="file" name="d" id="frm-d" data-nette-rules='[{"op":":fileSize","msg":"The size of the uploaded file can be up to %d% bytes.","arg":%d%}]' form="frmid" class="text"></td> | ||
</tr> | ||
|
||
<tr> | ||
<th></th> | ||
|
||
<td><label for="frm-f"><input type="checkbox" name="f" id="frm-f" form="frmid"></label></td> | ||
</tr> | ||
|
||
<tr> | ||
<th><label></label></th> | ||
|
||
<td><label><input type="radio" name="g" form="frmid" value="0">item</label></td> | ||
</tr> | ||
|
||
<tr> | ||
<th><label></label></th> | ||
|
||
<td><label><input type="checkbox" name="h[]" form="frmid" value="0">item</label></td> | ||
</tr> | ||
|
||
<tr> | ||
<th><label for="frm-i"></label></th> | ||
|
||
<td><select name="i" id="frm-i" form="frmid"></select></td> | ||
</tr> | ||
|
||
<tr> | ||
<th><label for="frm-j"></label></th> | ||
|
||
<td><select name="j[]" id="frm-j" form="frmid" multiple></select></td> | ||
</tr> | ||
|
||
<tr> | ||
<th><label for="frm-k"></label></th> | ||
|
||
<td><input type="color" name="k" id="frm-k" form="frmid" value="#000000"></td> | ||
</tr> | ||
|
||
<tr> | ||
<th></th> | ||
|
||
<td><input type="submit" name="l" form="frmid" class="button"> <input type="button" name="m" form="frmid" class="button"> <input type="image" name="n[]" form="frmid" class="imagebutton"></td> | ||
</tr> | ||
</table> | ||
|
||
<input type="hidden" name="e" value="" form="frmid"><input type="hidden" name="none" value=""><input type="hidden" name="diff" form="different" value=""> | ||
</form> |