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

Create special form widget for vCard email field #3512

Open
dafeder opened this issue Jun 9, 2021 · 3 comments
Open

Create special form widget for vCard email field #3512

dafeder opened this issue Jun 9, 2021 · 3 comments

Comments

@dafeder
Copy link
Member

dafeder commented Jun 9, 2021

DCAT-AP uses the vCard format to store contact info, which contains a hasEmail field. The hasEmail field requires a mailto: prefix before the email address, which is obviously not intuitive to have to enter in the form. Let's create a new email widget available from the UI schema that handles this out of the view of the user.

Acceptance criteria

  • Widget hides mailto prefix from input when editing existing vCard with this value
  • Prefix is added after submission before validation
  • Input gets html5 "type=email" attribute for initial browser validation
  • In default dataset.ui schema, hasEmail is assigned to the widget
@dafeder
Copy link
Member Author

dafeder commented Jun 10, 2021

Upon further review, this is a problem more of our own making. We do want to fix the form to deal better with hasEmail values that include the mailto: prefix, but in the metadata that triggered the issue we are not harvesting from a third party and can simply remove them ourselves. De-prioritizing for the time being.

@stefan-korn
Copy link
Contributor

@dafeder : I am currently also stumbling into this.

The vcard format requires the mailto: prefix for the hasEmail property. Therefore this is added in the demo content before the email address, like this: mailto:data.admin@example.com

Now data.json is outputting the vcard:hasEmail with the mailto prefix.

But upon saving the dkan dataset in the drupal backend, you are getting "invalid email" message (probably from HTML-5 validation?) and cannot save until you remove the mailto prefix. Now if you remove the mailto prefix the vcard:hasEmail property is no longer valid I suppose.

So this seems to be an issue at hand. If you are entering datasets via the backend you are not able to provide valid vcard:hasEmail property as far as I can see?

Imho the mailto prefix should be automatically set on the hasEmail property. Only on output, but not in the data?

@stefan-korn
Copy link
Contributor

see #3966 for possible fix.

Can probably be improved, but should do it for the moment. First three acceptance criterias might be met. About the last one I am not sure, whether it is really necessary to have a separate widget.

It's not so easy (for me perhaps) to get into the output of data.json and just inject it there. So I opted for inserting mailto: into the data saved (Prefix is added after submission before validation).

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

2 participants