On creating an iframe field, and set to not be required, the width and height fields are shown as required and will not allow you to submit the entities form without entering a value

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

iancawthorne created an issue. See original summary.

pareshpatel’s picture

Assigned: Unassigned » pareshpatel
pareshpatel’s picture

Status: Active » Needs review
FileSize
875 bytes

I have removed the required from Width and Height fields.

Please find the attached patch.

iancawthorne’s picture

Thanks for the patch @pareshpatel. I've tested it and it looks ok to me.

  • 3238bd3 committed on 8.x-1.x
    Issue #2748283 by pareshpatel: Width and Height fields are required all...
neffets’s picture

Assigned: pareshpatel » neffets
Status: Needs review » Closed (fixed)

Hmhm?

A iframe needs a width and a height. So its finally required for ever.

But YES, if we choose Manage-Form-Display for iframe to "URL with height" it
* should show only the URL and height field to the normal editor
* but have not to require the editor to give an width, because its not possible to give.

I bugfixed: If You choose some default values for width and height at Manage-Form-Display (work-symbol right to iframe), then now it will be used for the single story as default values.
These values will now be default for not shown fields (depending from the choosen Widget-Type)

==> I will not take the global patch to require nothing. But I fixed it in IframeUrlheightWidget.php and IframeUrlWidget.php, to preserve the default values for not-shown-fields AND that they are not required in case that the admin forgot to fill in default-values in Manage-Form-Display

// /admin/structure/types/manage/story/form-display

FIXED in 8.x-1.5

neffets’s picture

Status: Closed (fixed) » Fixed
iancawthorne’s picture

Status: Fixed » Active

Sorry, but I think there is some confusion @neffets, this is not related to width and height being required for an iframe - that is absolutely correct, but not what the issue is.

If I create an iframe field on a content type, set it to not be required, it should be optional to choose to populate that field when creating a node... so if I create a node that does not have an iframe value, I'm unable to submit the form without specifying width and height values for a non existent iframe.

I would expect the width and height fields to only fail form validation if the iframe url is populated?

I've checked this in the 8.x-1.5 and that is still the case.

  • neffets committed 62bc81b on 8.x-1.x
    Issue #2748283 by pareshpatel, neffets: Width and Height fields are...

  • neffets committed ee41d6f on 8.x-1.x
    Issue #2748283 validate width/height only if provided by form
    
neffets’s picture

Status: Active » Fixed

* Removed the requireness for width/height from IframeWidgetBase.php for authors view of node-edit.
* Added Validator, which check the value (number or number+"%")
* Validates width/height only if provided by form.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.