Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for required / requiredIf #4

Open
FlipZoomMedia opened this issue Apr 28, 2020 · 3 comments
Open

Support for required / requiredIf #4

FlipZoomMedia opened this issue Apr 28, 2020 · 3 comments

Comments

@FlipZoomMedia
Copy link

Great module! Makes a lot of work easier and avoids unnecessary fields. Thanks! It would be very useful if support for "required" and "requiredIf" existed. Do you think it is possible to implement this?

@trk
Copy link
Owner

trk commented Feb 20, 2021

required attribute supported, requiredIf can you send me a processwire api page for check this feature ?

if you set required attribute, you need to set defaultValue like core fields.

'field' => [
     'required' => true,
     'defaultValue' => 'you-need-set-default-value'
]

@jlahijani
Copy link

I see that adding 'required' adds the red star, but if the field is left blank and you save the page, ProcessWire doesn't show the red warning message saying the field is required like it does with normal fields.

@trk
Copy link
Owner

trk commented Feb 25, 2021

I see,

When preparing fields i need to store required field names and requiredIf field names like language fields on here : https://github.com/trk/Mystique/blob/next/src/FormManager.php#L120

After that, i need to check required field empty or not and requiredIf field also on here : https://github.com/trk/Mystique/blob/next/InputfieldMystique.module.php#L195

I will add this support

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants