Jump to content

Search the Community

Showing results for tags 'prevent duplicates'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 1 result

  1. Hi there, Is there is a built-in way to prevent duplicates when it comes to the Repeater field type? The Repeater I have setup contains two fields: one is a select list of other Pages and the second is just a text field. Ideally, I'd love the select list of Pages to work similarly to how the Fields list in Admin works. As you're adding Fields to a Template, the ones you've already added become disabled in the list so they cannot be added again. If that's not possible, then would something like the following be the next best solution as a module? public function init() { $this->addHookAfter("InputfieldRepeater::processInput", $this, "validateNoDups"); } public function validateNoDups($event){ $field = $event->object; if($field->name == "technical_specs"){ $page = $this->modules->ProcessPageEdit->getPage(); $specs = $page->get("$field->name"); $s = array(); foreach($specs as $spec) { if ($spec->technical_spec) { $s[] = $spec->technical_spec->title; } } $dups = $this->get_duplicates($s); if ($dups) { $field->error("You have duplicate technical specs: " . implode(', ', $dups)); } } } Thanks! Lauren
×
×
  • Create New...