forms icon indicating copy to clipboard operation
forms copied to clipboard

Ability to embed form into website

Open jancborchardt opened this issue 4 years ago β€’ 16 comments

Similar to how we do with the Calendar, it would be great to be able to embed a shared form into a website, as sort of a permanent survey or contact form. Google Forms allows this and it’s often used on websites.

@rullzer said it needs some special view (like Calendar has) and also needs some CSP etc magic set.

jancborchardt avatar Apr 30 '20 22:04 jancborchardt

Crowdsignal (from Automattic) allows this. See this as an example.

It is useful, but in my opinion less important than a rich questionnaire form builder. For doing user research, I usually explain "please fill out this form hosted on XYZ".

ei8fdb avatar May 06 '20 11:05 ei8fdb

Agree with @ei8fdb ! Definitely nice to have but not a dealbreaker (at least in my similar experiences when we were conducting user research).

elioqoshi avatar May 17 '20 17:05 elioqoshi

I use the same NC instance for different projects and having mismatching visual identities is not so nice. The embedded form would be great, especially with possibility to overwrite styles, as in Nextcloud appointments: https://github.com/SergeyMosin/Appointments

fmorato avatar Aug 31 '20 09:08 fmorato

I think simple embedding should work when allowing iframes as described here? https://return2.net/nextcloud-enable-external-iframe/

KuestenKeks avatar Sep 15 '20 20:09 KuestenKeks

Yes, it just need a new endpoint like /embed/{formhash} And use a different simple template like https://github.com/nextcloud/files_pdfviewer/blob/419c59d1aa01ba75b3d0645cec28e36c8747dd4d/lib/Controller/DisplayController.php#L59

skjnldsv avatar Sep 15 '20 20:09 skjnldsv

I use the same NC instance for different projects and having mismatching visual identities is not so nice. The embedded form would be great, especially with possibility to overwrite styles, as in Nextcloud appointments: https://github.com/SergeyMosin/Appointments

overwrite styles or use of html file, in order to create a complex form (several fields on a same line, group of fields, colors, ...) would be great to inscription / contact / request form in a web page.

Another approach would be to record a response to a Form by a post from any html page. In addition this would allow the realization of certain issues while awaiting their integration into Form.

May I have an approximate date of the availability of a such feature? Thanks your app

Lionel-cl avatar Nov 02 '20 21:11 Lionel-cl

Lionel,

I agree that it'd be great to hove such feature. Do I understand that you'd like to sponsor the feature?

2 Nov 2020 23:01:27 Lionel-cl [email protected]:

I use the same NC instance for different projects and having mismatching visual identities is not so nice. The embedded form would be great, especially with possibility to overwrite styles, as in Nextcloud appointments: https://github.com/SergeyMosin/Appointments

overwrite styles or use of html file, in order to create a complex form (several fields on a same line, group of fields, colors, ...) would be great to inscription / contact / request form in a web page. May I have an approximate date of the availability of this feature?

β€” You are receiving this because you commented. Reply to this email directly, view it on GitHub[https://github.com/nextcloud/forms/issues/324#issuecomment-720721973], or unsubscribe[https://github.com/notifications/unsubscribe-auth/ADA26Y5ZANZC6QQDMLXSFXLSN4M2LANCNFSM4MWVVSKQ]. [https://github.com/notifications/beacon/ADA26YY4M7776LXQOZOBFL3SN4M2LA5CNFSM4MWVVSK2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOFL2VQNI.gif]

fmorato avatar Nov 03 '20 06:11 fmorato

@fmorato,

Why not. But only if I am sure that the contents of the app version meet all my needs and not just this feature.

Lionel-cl avatar Nov 03 '20 11:11 Lionel-cl

@Lionel-cl While this embed feature have been approved, I cannot guarantee that all of your needs are on the roadmap of this repo. Please check existing issues and open new tickets if necessary (duplicates will be closed). I'll suggest you arrange yourself with @fmorato to sponsor tickets that are already accepted and set 1. to develop.

skjnldsv avatar Nov 03 '20 11:11 skjnldsv

Hi, I would like to quote @Lionel-cl from above:

Another approach would be to record a response to a Form by a post from any html page. In addition this would allow the realization of certain issues while awaiting their integration into Form.

As the Forms API has now been documented, I would like to ask if there is or could be a way of submitting responses anonymously without authentication. I would need something similar to the submission/insert endpoint, but just without the need of having an user account on the nextcloud instance.

ialokim avatar Mar 06 '21 18:03 ialokim

I am wondering if the request token is persistent? If that is the case, one could use an HTML form and then POST the content of the form to Nextcloud. Or am I missing something? Of course a well-supported way to embed the form (with custom styling) would be even better.

lukasstevens avatar May 14 '21 17:05 lukasstevens

Hey @lukasstevens, to be honest i can't exactly answer your question about the request-token. However, for your use-case it sounds like you just want to create your own form and use the API, no? This is already possible using the ocs api, even without the token. You can have a look into the documentation: ☺️ https://github.com/nextcloud/forms/blob/master/docs/API.md#insert-a-submission

jotoeri avatar May 17 '21 18:05 jotoeri

Not sure if this would be the same request, but it would be welcome if the complete nextcloud instance could be embedded on an trusted iFrame, so with ability to login.

Apart from that I think this would also apply for example to Deck, and the ability to create an embedded link for one, so you could create a shared Kanban board integrated on a separate website. Should I create a separate ticket for such request or would this one fill the need?

Aesculapius avatar Jul 16 '21 21:07 Aesculapius

Hey @Aesculapius, please take care, this is only the repository for the forms app. So for feature-requests for server or for the deck-app, please head over to the respective repositories. Greets, Jonas

jotoeri avatar Jul 21 '21 22:07 jotoeri

I managed to embed a Nextcloud Forms formular in a static HTML page built with Nikola. The Nikola plugin (see this pull request) extracts the JSON form definition from the public site (shared link) and builds a static HTML form accordingly. When submitting the form data is collected by JS and submitted to the public OCS API of Nextcloud Forms.

This is not including the form as iframe, but suits my use case very well. Maybe this approach serves a starting point for other implementations as well.

Heads up: I had some trouble with sending the form data with a XMLHttpRequest due to CORS limitations. Nextcloud OCS API and Nextcloud Forms don't handle CORS preflight check correctly! The pull requests Nextcloud Forms #1139 and Nextcloud Server should fix it.

everlanes avatar Mar 25 '22 09:03 everlanes

Yeah, it almost works!

I linked a Nextcloud Form to an 11ty website, for which I build the form accordingly to the form definition.

The only missing piece of the puzzle is the landing:

  • sending the form directly via the HTML <form> seems out of question because I hit a CSRF error
  • intercepting the form submission and sending it via fetch() fails because I lack of a CORS configuration (on the NextCloud side of things β€” I don't know yet if it's due to the server configuration, or a NextCloud setting)

thom4parisot avatar May 17 '22 13:05 thom4parisot