Comments (6)
@terabytesoftw I meant this test:
Yiisoft\Form\Tests\Widget\NoExistTest::test Undefined property: Yiisoft\Form\Tests\Stub\PersonalForm::$undefined_form_attribute
as you said above.
from form.
Of course you are just creating the object, you are not rendering it.
(new TextInput)->config($data, 'undefined_form_attribute')->run();
TextInput::widget()->config($data, 'undefined_form_attribute')->run();
<?= (new TextInput)->config($data, 'undefined_form_attribute') ?>
<?= TextInput::widget()->config($data, 'undefined_form_attribute') ?>
- Yiisoft\Form\Tests\Widget\NoExistTest::test Undefined property: Yiisoft\Form\Tests\Stub\PersonalForm::$undefined_form_attribute
from form.
Please reopen issue. In your described cases widget still no throws exception for undefined field
class LoginForm extends FormModel {
private ?string $login;
private ?string $password;
/* ... */
}
echo (new TextInput)->config($formModel, 'login')->run();
echo (new PasswordInput)->config($formModel, 'password')->run();
echo (new TextInput)->config($formModel, 'undefined_form_attribute')->run();
in html i got this
<input type="text" id="login" name="login">
<input type="password" id="password" name="password">
<input type="text" id="undefined_form_attribute" name="undefined_form_attribute">
from form.
@terabytesoftw tests do not exist for undefined form field
from form.
Please reopen issue. In your described cases widget still no throws exception for undefined field
class LoginForm extends FormModel { private ?string $login; private ?string $password; /* ... */ }
echo (new TextInput)->config($formModel, 'login')->run(); echo (new PasswordInput)->config($formModel, 'password')->run(); echo (new TextInput)->config($formModel, 'undefined_form_attribute')->run();
in html i got this
<input type="text" id="login" name="login"> <input type="password" id="password" name="password"> <input type="text" id="undefined_form_attribute" name="undefined_form_attribute">
You can put all the code to reproduce the error clearly you must have some problem in your php configuration, I already added the exception but it is redundant all the widgets use getAttributeValue()
, and when looking to return the value of the property it should throw the error because it does not exists.
I still wonder why it does not generate the error, if it is tested.
@rustamwin We must verify well, I think it is not a bug.
from form.
@terabytesoftw tests do not exist for undefined form field
I don't need to test the widget because it is clearly tested in the FormModel.
Any object that calls a property that doesn't exist php will return an error.
from form.
Related Issues (20)
- Use array_key_exists instead of isset on check value
- Adapt after removing result set in validator
- Rename FormErrors to FormErrorSet (and similar) - consistency, best practices HOT 1
- Yiisoft\Form\Widget\Validator\FieldValidator::getValidatorAttributes() shouldn't apply required attribute for Required rule indiscriminately
- Remove filter of null values in methods for setting classes HOT 1
- Code style - chain calls HOT 15
- Add `$content` parameter to `Field::*Button()` methods
- Yiisoft\Validator\DataSet\AttributeDataSet not found
- Dependency update/adjust to yiisoft/html HOT 2
- Nested array form with translations HOT 3
- Checkbox don't accept label parameters HOT 1
- Input field name array HOT 1
- Add php attribute like #[SkipHydration] to skip private properties in collectAttributes() HOT 1
- Naming issue: attribute HOT 1
- Allow use fields without form model HOT 1
- Add constant with default theme and theme parameter to `Field` helper HOT 1
- Make fields indepent from validator HOT 1
- Raise PHP version to 8.1 HOT 1
- Add theme for Bootstap 5 HOT 1
- Checkbox 'checked' parameter input HOT 20
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 form.