I have a link field and a boolean field. The link field will be displayed when the checkbox is ticked. However, the validation of the URL field stopped from working. The URL validation is working OK with no conditional rule.
I'm expecting to see the Manually entered paths should start with one of the following characters: / ? # error message when submitting the node. Without the validation, the front-end gets InvalidArgumentException: The internal path component 'www.google.com' is invalid. Its path component must have a leading slash, e.g. internal:/foo. in Drupal\Core\Url::fromInternalUri() (line 413 of core/lib/Drupal/Core/Url.php). error.
Steps to reproduce:
1. Manage dependencies.
2. Add link field in target field.
3. Add boolean field in controlled by.
4. The dependency would be the target field is visible when the control field is checked.
5. Edit or add a new node.
6. Tick checkbox.
7. Enter an URL that starts with "www" (eg. www.google.com) in the link field.
8. Save.
9. Check the node page.
| Comment | File | Size | Author |
|---|
Comments
Comment #2
larisse commentedHi! I think this patch will solve the problem!
Comment #3
larisse commentedComment #4
paulocsPatch #2 looks good to me.
Comment #5
colanIs this still a problem in 4.x?
Comment #6
larisse commentedHi!
This still a problem in 4.x version. I have installed and test and URL validation link field still break the site, like you can see in image below. It's works after apply the patch.
Comment #7
colanI just requeued #2 for testing.
Comment #8
kris77 commentedPatch in #2 works for me in 4.x dev.
Thank you so much @larisse
Comment #9
madelyncruz commentedThe patch works for me too. Thank you larisse!
Comment #10
thallesThanks everyone!
Comment #12
thallesComment #14
alexandru.dumitru commentedThis patch will trigger all errors, regardless if field if visible/hidden via conditional fields.
For example, apply the patch and hide a required field with conditional fields. Error will be triggered for the required field.
Comment #15
jonloh commentedI can confirm this patch triggered all errors regardless if the field is visible/hidden, as mentioned in #14.
Another issue is open to discuss this further: https://www.drupal.org/project/conditional_fields/issues/3344587
Comment #16
dqdThis "dirty fix" in here committed caused many trouble including #3344587: Support for field hidden by condition losing its required status So I reopen this issue to discuss a better solution.
Comment #17
heddnIs the dirty fix sufficient for us to mark a beta though?