Hello.
At the moment we can apply module only for string-type fields, but I need to use it with Number (integer) field. So I've checked current module implementation and done little tuning for it, check it, please.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

drholera created an issue. See original summary.

drholera’s picture

StatusFileSize
new7.6 KB

And 1 more patch with better unique checks.

bloomt’s picture

How hard would it be to patch it for the date field as well?

drholera’s picture

StatusFileSize
new7.89 KB

I've found a small bug in the previous patch. Here is the new one.

About date field. I hope I'll have enough time to check it this or next week.

drholera’s picture

Status: Active » Needs review
drholera’s picture

StatusFileSize
new9.24 KB

The last one was kind of broken. I've added fixes.

rgristroph’s picture

I've read through this patch, and we've been using it for a month or so, and it seems to work fine.

duckduckgoose’s picture

StatusFileSize
new9.3 KB

A slight modification to the last patch to fix a bug that was sometimes preventing edits to the field config itself after marking the field unique.

Nitish k’s picture

I tried this patch, worked for number field but the content type in which I applied for unique field I am not able to add multiple paragraphs.

dqd’s picture

Version: 8.x-1.2 » 8.x-1.x-dev
Status: Needs review » Needs work

Tremendous work done here already! Heads up! But please let's file patches against latest dev to stack up the features correctly for a next release candidate.

A slight modification to the last patch to fix a bug that was sometimes preventing edits to the field config itself after marking the field unique.

This sounds suspicious. Set it to needs work. We need more tests here. Can #9 provide more info? Did you used the latest patch of #8 and did you tested it with a patch version from before also?

andyd328’s picture

The patch in #8 is working for me with a single entry integer field used against 8.x-1.2.

My feeling is that the patch, despite its small size, contains too many unrelated changes. To get my use case working the only change I needed to make was adding 'integer' to the field type list in unique_field_ajax_form_field_config_edit_form_alter().

I haven't tested the patch beyond my immediate needs, but perhaps if the code quality changes are addressed separately it will be easier to pull apart how patch #8 caused issue #9 - if it did.

arnaldop’s picture

This is a great patch and is working for me just fine.
However, the numeric field has arrow controls to increment and decrement the number.
If the users uses those controls, the JavaScript keyup event does not fire.

I tweaked it locally to use the change event, which fires whenever there is a change to the field.
Does anyone have any thoughts or recommendations on this?

Thanks for the great module and a great patch!

arnaldop’s picture

StatusFileSize
new10.07 KB

Here's the patched patch, with the change from the keyup event to the change event.
I also changed the JavaScript file name to better reflect the contents.

dqd’s picture

@#13 can you please provide a interdiff (done) between #13 and #8 ? ... Thanks for keeping up this work!

dqd’s picture

StatusFileSize
new1.63 KB

Never mind, done for those who want a quick review ...

joelpittet’s picture

Status: Needs work » Needs review
abhaypai’s picture

Status: Needs review » Reviewed & tested by the community

Works as expected.

Eli.Stone made their first commit to this issue’s fork.

3li’s picture

Version: 8.x-1.x-dev » 2.x-dev
Assigned: Unassigned » 3li
Status: Reviewed & tested by the community » Needs work

Will work on adding this to the 2.x branch

3li’s picture

Status: Needs work » Needs review
3li’s picture

Assigned: 3li » Unassigned

3li’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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