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
Hi patch-works I did something similar with Drupal 7: a block with aniversaries of historical dates. You can see it at https://lassalle-kreis.de/ down in the blue footer, the middle column...
How to get a list of upcoming birthdays?
@indigoxela - I agree, I mentioned the SVG topic specifically for the dev meeting. I think we'll definitely want Nate involved in that discussion. Good call!
Apr 18th Weekly Meetings
Hi colbyat, re display in the browser: the problem is that when a 500 occurs, this PHP process died before being able to render anything. So that won't work. Logging is possible, but...
Displaying 500 errors