This came up as an idea in https://github.com/backdrop/backdrop-issues/issues/5348#issuecomment-100...
@quicksketch
This issue ... may also be helpful if we were to ever add a server-side conditional system to replace
#states
. By separating out the required message into its own property, we could conditionally display the required message without executing the entire form_validate()
handler.
The #states
property is a front-end only implementation. The lack of any server-side processing means any hidden fields cannot be required, or special validation handlers need to be added that validate field requireness manually.
Proposal
Introduce a new Form API property for designating conditional processing of parts of a form. This property would hide/show elements on the front end (like #states
does already), but would also conditionally skip processing for hidden parts of the form. Hidden parts of the form would skip:
- Processing of the
#required
attribute on hidden fields - Processing of
#element_validate
handlers on hidden fields - Remove any values from
$form_state['values']
for hidden fields
Recent comments
Hello, @yorkshirepudding! Thanks a lot, I got it, all sorted out.
My layout template (layout--blog.tpl.php) doesn't work
Hi @Gnome and welcome to Backdrop When I create custom layout templates I put them in /layouts/custom/my_layout Note: you can split modules and layouts between contrib and custom...
My layout template (layout--blog.tpl.php) doesn't work
This post explains how to do this in Drupal 7. In Backdrop, File Entity is already part of core. You will need to download and install module Views Field View. https://drupal.stackexchange...
I Need to Display an Image in a View that was Uploaded to a Webform