The webform module manages his state (opening and closing) with a radiobox. Would it be possible to permit/add the configuration of this state:
- with 2 date-time (for opening and closing date),
- or/and with the use of a token refering to 2 fields from the content type which refer to the webform.

Comments

benfarhat created an issue. See original summary.

CatherineOmega’s picture

I think this might be a duplicate of https://www.drupal.org/node/2779461?

benfarhat’s picture

StatusFileSize
new73.34 KB

Thank you for your answer Catherine, I don't think it's the same, if I understood correctly, jreydet ask for an automatic update of a users form submission as soon as this user change one of its settings (email address or others).

My request only concerns the way we activate (open) or desactivate (close) a webform (status form is set by a radiobox "open" or "close").
I have a content type "job application" where i have two fields (date) "open-registry" and "close-registry" and a referer to a "job application form".

I don't know if i'm clear but i ask for the possibility to open or close my "job application form" (for a node) manually with 2 dates (and not only with a radiobox that open or close) and eventually by using a sort of tokens that use these fields "open-registry" and "close-registry" to set the "job application form" status.
_________________________________________________________________________________
open close webform with dates

jrockowitz’s picture

I think you can use the Scheduler module and/or the Rules module to implement this feature.

I do see a benefit to having this feature included in the core Webform module and it should be added to the Webform module's backlog/wishlist.

benfarhat’s picture

Thank you for your answer Jacob,
Unfortunately Scheduler only work with nodes (webform scheduler permit it but it only works with webform 7.x) and I don't find a way to make this feature works with Rules...

jrockowitz’s picture

I am think adding a close/open date makes sense. I am not sure about token support because it could be very buggy but I do feel that an open/close date will need to be added to the Webform entity and the Webform field type.

Below is the Webform entity...

Here is the Webform field type..

For now, I am solely focusing on getting open/close date support added the Webform entity. Once this is done, I will create a new ticket for adding open/close date support to the Webform field type.

  • jrockowitz committed b3d6fce on 2845724-open-close-date
    Issue #2845724 by jrockowitz, benfarhat: Add webform status...

  • jrockowitz committed d93d9e6 on 2845724-open-close-date
    Issue #2845724 by jrockowitz, benfarhat: Add webform status...
jrockowitz’s picture

Status: Active » Needs review
StatusFileSize
new69.14 KB

  • jrockowitz committed 2b7624a on 2845724-open-close-date
    Issue #2845724 by jrockowitz, benfarhat: Add webform status...

Status: Needs review » Needs work

The last submitted patch, 9: add_webform_status-2845724-8.patch, failed testing.

  • jrockowitz committed 645c8e6 on 2845724-open-close-date
    Issue #2845724 by jrockowitz, benfarhat: Add webform status...
jrockowitz’s picture

Status: Needs work » Needs review
StatusFileSize
new77.54 KB

Status: Needs review » Needs work

The last submitted patch, 13: add_webform_status-2845724-13.patch, failed testing.

  • jrockowitz committed 01c8cdf on 2845724-open-close-date
    Issue #2845724 by jrockowitz, benfarhat: Add webform status...
jrockowitz’s picture

Status: Needs work » Needs review
StatusFileSize
new76.65 KB

  • jrockowitz committed 4f7f7ba on 2845724-open-close-date
    Issue #2845724 by jrockowitz, benfarhat: Add webform status...
jrockowitz’s picture

StatusFileSize
new81.98 KB

  • jrockowitz committed 14d0d0b on 2845724-open-close-date
    Issue #2845724 by jrockowitz, benfarhat: Add webform status...
jrockowitz’s picture

StatusFileSize
new82.08 KB

Here is hopefully the final patch.

  • jrockowitz committed d875915 on 8.x-5.x
    Issue #2845724 by jrockowitz, benfarhat: Add webform status...
jrockowitz’s picture

jrockowitz’s picture

StatusFileSize
new156.07 KB

Below is a screenshot of the 'Scheduled' settings.

goldlilys’s picture

After updating webform to version 8.x-5.0-beta8 , when running drush updb

I'm getting the following error:

webform module :
8020 - Issue #2845724: Add webform opening and closing datetime.

Do you wish to run all pending updates? (y/n): y
Invalid "1" status argument. [error]
Performing webform_update_8020 [ok]
Failed: Invalid "1" status argument. [error]
Cache rebuild complete. [ok]
Finished performing updates.

And it never is able to update that part because when I run drush updb again, that entire thing shows up again. Not sure if anyone else has had this trouble?

jrockowitz’s picture

Anonymous’s picture

Hello Jacob,

there is a little problem with the new Scheduler feature. It depends on the Templates "submodule" to work. So when the Templates module is not active, the states can't be true and the scheduler date fields will never show up.

WebformEntitySettingsForm.php (line 217)

      '#states' => [
        'visible' => [
          ':input[name="template"]' => ['checked' => FALSE],
          ':input[name="status"]' => ['value' => WebformInterface::STATUS_SCHEDULED],
        ],
      ],

The template input is only in the form with an active Templates module. Maybe it's better to conditionally hide (disable) the entire scheduling radio when a form becomes a template and leave a note about the reason for disabling it.

Best regards

Mike

jrockowitz’s picture

Status: Fixed » Needs review
StatusFileSize
new1.52 KB

The attached patch should address this issue.

  • jrockowitz committed 21fb53b on 8.x-5.x
    Issue #2845724 by jrockowitz, benfarhat: Add webform status...
jrockowitz’s picture

Status: Needs review » Fixed

I committed the patch. Please download and review the latest dev release.

jrockowitz’s picture

Status: Fixed » Active
StatusFileSize
new5.72 KB
jrockowitz’s picture

Status: Active » Needs review

  • jrockowitz committed 1e0b5a9 on 8.x-5.x
    Issue #2845724 by jrockowitz, benfarhat: Add webform status...
  • jrockowitz committed 5550fa5 on 8.x-5.x
    Issue #2845724 by jrockowitz, benfarhat: Add webform status...
jrockowitz’s picture

Status: Needs review » Fixed
stella’s picture

Awesome! Thanks jrockowitz!

Status: Fixed » Closed (fixed)

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