Existing :
In existing system, All cell in tablefield are “textfield”, where there is no option to have date field in the table cells.

Date in TableField:This patch will allow a date field in table cell(particular column) by specifying exact column numbers in field settings form.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

saranya ashokkumar’s picture

FileSize
4.89 KB
saranya ashokkumar’s picture

Status: Active » Needs review
lolandese’s picture

Thanks Saranya,

If you don't mind I add the link to your blog post that showcases this functionality:
http://www.unimitysolutions.com/blog/working-experience-table-field-cont...

lolandese’s picture

Priority: Minor » Normal
FileSize
5.23 KB

Reroll against latest dev.

thynan’s picture

Hi! This patch can't be applied anymore. Is it feasible to reroll it, or were there too many changes made in the codebase? If so, is there a better way to implement this functionality now?

lolandese’s picture

Is it feasible to reroll it?

Yes. Try to apply changes "by hand", reroll and post a new patch here. Thanks.

saranya ashokkumar’s picture

FileSize
5.07 KB

I have re-rolled patch for the current dev. please review.

useernamee’s picture

Hey, I have tested the patch and it applies nicely. I just have a problem that I can not validate the form if I choose value in date field.

I get the following notice:
Notice: Undefined index: object in Drupal\Core\Datetime\Element\Datetime::validateDatetime() (line 370 of /var/www/sandbox/web/web/core/lib/Drupal/Core/Datetime/Element/Datetime.php) #0 /var/www/sandbox/web/web/core/includes/bootstrap.inc(582): _drupal_error_handler_real(8, 'Undefined index...', '/var/www/sandbo...', 370, Array) #1 /var/www/sandbox/web/web/core/lib/Drupal/Core/Datetime/Element/Datetime.php(370): _drupal_error_handler(8, 'Undefined index...', '/var/www/sandbo...', 370, Array) #2 [internal function]: Drupal\Core\Datetime\Element\Datetime::validateDatetime(Array, Object(Drupal\Core\Form\FormState), Array) #3 /var/www/sandbox/web/web/core/lib/Drupal/Core/Form/FormValidator.php(283): call_user_func_array(Array, Array) #4 /var/www/sandbox/web/web/core/lib/Drupal/Core/Form/FormValidator.php(239): Drupal\Core\Form\FormValidator->doValidateForm(Array, Object(Drupal\Core\Form\FormState)) #5 ...

And error:
The date is invalid. Please enter a date in the format 2018-04-18.

I can't set the field in this format because dd/mm/yyyy is allowed.

If I change type of tablefield in method processTablefield (from datetime into date) I still get similiar notice (Undefined index: Object in Drupal\Core\Datetime\Element\Date::processDate() ...) but at least the form gets validated and values are saved.

(I am on Drupal 8.5.1 and php 7.1)

saranya ashokkumar’s picture

@useernamee ,
I think this error due to Drupal version. Already some issue going about this error in core.
https://www.drupal.org/project/drupal/issues/2812925

useernamee’s picture

I thought it might be some other issue.