Questions tagged [custom-field]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
5 views

Craft 3 Matrix Field customFields property 'required' and 'sortOrder' fields null

I'm trying to dynamically build a frontend form based on a Matrix field. I'm iterating over the entry.aMatrixField.customFields array which returns me an array of field objects in Twig. The field ...
1
vote
1answer
21 views

Custom field plugin: Unable to find template / General custom field plugin information

I am still relatively new to Craft CMS. I am trying to make a custom field plugin for Craft 3 but I am struggling to understand why I can't render my form template. The fieldtype should render a map ...
0
votes
0answers
23 views

Geocode address when saving custom field type in plugin

I've got a Craft CMS 3 plugin that has a custom field type for entering an address. When saving that field I'd like to take that address and geocode it using Google's Geocode API and save the latitude ...
1
vote
1answer
26 views

Entries search query by 2 custom fields

So I have a Entry type that has two custom fields on it. Both fields are integer fields. I'd like to make a query in PHP that gets the entries by two custom fields, both of which are integer values. ...
0
votes
1answer
43 views

Add rows to editableTableField via custom javascript

I am making a custom field via a module. I have an editableTableField that will hold the actual field values saved to an entry and I have other HTML elements that are used to grab data from a ...
1
vote
0answers
22 views

Customer (Member) Profile Page

I have a site where I'd like customers to login and be immediately presented with their profile page (and ONLY their profile page). On this page they can: 1. See progress reports on their jobs (...
2
votes
1answer
43 views

How can additional custom fields be added to the Sites settings?

In Craft 3 Sites, there are some default fields like language, handle, etc. I would like to add additional fields. Is this possible. Specifically, I want to add an Image field so we can add a flag ...
1
vote
2answers
57 views

how to search for entries where a custom field is either not present or is empty

Some of my entries have the optional plaintext field myCustomField. I want to retrieve all entries except those where myCustomField is filled out. I can get all entries that have an empty ...
0
votes
1answer
41 views

For loop through custom field in JavaScript

I'm using a script to animate four sets of numbers on a page. I would like the numbers to be editable from within the admin (a SuperTable field). Currently I have this: <ul class="counters"> ...
1
vote
0answers
66 views

Element type vs. Field type - or: Element type without database storage?

I have already searched for information on this topic but I did not find much. I hope I did not overlook something. My problem is the following: I want to try to write a plugin that lists entries ...
2
votes
1answer
139 views

How to store custom data into a user

I need some direction in how to store (complex) data into users (best practice) I'm working on a project for a fitness app. I created a structure with 2 levels for workouts where level 1 entries are ...
3
votes
1answer
24 views

Partial Dates within Craft

Is it possible to store partial dates? EG i want to create a document that covers a date range, sometimes that range could be Jan/2013 to JUN/2014 other times we may need it more specific EG 20/JAN/...
2
votes
1answer
63 views

saving user field type custom field - Failed to set unsafe attribute

I have tried to save a custom field of "user field" type which resulted in this error. "Failed to set unsafe attribute" code: $order->setAttributes(array( 'operatorUid' => Craft::$app-&...
1
vote
2answers
397 views

How can I get entry id in field

I create a new filed type and attached it to entries. Now I need to get the entry id which the field is attached to. I tried $this->element in my field class, but got an error said that I'm ...
0
votes
1answer
155 views

Get custom field value on entries.onBeforeSaveEntry event

I am trying to get a custom field value on entries.onBeforeSaveEntry, event. So I can perform some action depending on the value of that field. craft()->on('entries.onBeforeSaveEntry', function(...
1
vote
1answer
79 views

Solspace Calendar: custom fields not outputting

I'm unable to get custom fields to output using Solspace Calendar on Craft3. I am not getting any errors indicating that the field does not exist, it's just not outputting. The field is a Redactor ...
2
votes
2answers
451 views

Adding Columns to a table

Is there a way or a plugin that allows you to add columns and change columns heading from within the entry? Instead of defining column heading while creating the table field. It would be nice to have ...
2
votes
2answers
100 views

Is it possible to populate admin form with data supplied by an external API?

I've been tasked with reviewing Craft as a potential solution for the company I work for and one of the requirements is that we need to be able to provide data from a external API in the page creating/...
1
vote
2answers
213 views

Retrieve entries on custom field date using ElementCriteriaModel

I am trying to retrieve an array of entries on a particular section where inspectionDate is greater than today's date. Here is the code. $criteria = craft()->elements->getCriteria(ElementType::...
1
vote
1answer
96 views

Add Checked Attribute to Custom User Fields on Frontend User Form

I have a multi-select for users to sign up for newsletters. When they edit their profile they need to be able to see which newsletters they are already signed up for. I have the code to output the ...
3
votes
3answers
342 views

Option and notes fields after cart at checkout for order, not just line items

My client has gift wrapping services but they apply to the entire order, not one single line item. How would I add notes or custom fields to the entire order, at the shipping stage of checkout? is ...
1
vote
1answer
188 views

Filter products by custom boolean field

I'm working on a online store website and we need a filter to hide some products based on the country. I created a lightswitch field called "Hide in Europe" (default false) and added it to the ...
0
votes
1answer
200 views

Add fields/custom fields to page in the admin page (backend)

following situation: let's assume I have page with some ARTICLES (textfields): Article1, Article2, Article3, etc.. Now is there a module for CraftCMS that I can add textfields (articles) to a page ...
1
vote
1answer
126 views

How to check for a value OR NULL on custom enddate field using yii syntax when calling entries?

I have a section of 'deals/coupons' with custom startDate and endDate. These are needed so the client can load up a bunch of deals but only have them render to the page when a particular deal is '...
0
votes
1answer
137 views

Anyway to programmatically add default fields to a layout?

So I've been building my plugin to import product listings directly from Salesforce. So far I've been making progress. However, I've approached another roadblock and I was wondering how I would ...
1
vote
1answer
2k views

How to save a new entry with custom fields - Craft 3

I'm trying to create a new Entry via PHP, with custom fields (Craft 3). I can save it, however my custom fields don't appear. I've tried using setFieldValue, as well as $entry->excerpt = 'Lorem...';...
1
vote
1answer
513 views

Create custom field to input canonical url in a page

What is the best way of creating a custom field for each page whereby the user can input a URL into a field, which then gets input into a rel=canonical element like the example below. <link rel="...
2
votes
1answer
639 views

Make fields conditionally required

Is there a way to make fields conditionally required? I have a toggle field that is used to hide or show a section (see screenshot: "Section 3 enabled"). If the section is shown (toggle: on), the ...
2
votes
1answer
60 views

date in database -1 day as on frond-end

We just found out that in the database birthday field, all dates has 1-day difference than what is shown on the front-end. On the front-end, it is the correct date by the way. Question: Is it a bug ...
2
votes
1answer
60 views

Save same Entry more than once with help of custom relations field

Is it possible to save the same Entry (red arrow) twice/more than once in one custom relations field? "Test Playlist" is a entry in a channel. Background: I have set up a playlist, where an entry ...
1
vote
2answers
75 views

Authentication by a custom field

I added a field called "phonenumber" to the user profile fields which I want to use for login purposes, too. Usually Craft allows an authentication by username or email-address. Is there a way to add ...
2
votes
1answer
213 views

Get future multi-day event entries with custom date field

I have an event section with custom fields for eventDate and eventEndDate. I'm listing upcoming events in my template using: {% for event in craft.entries.section('events').eventDate('>='~now)....
1
vote
2answers
169 views

Custom fields on a structure or section archive page

I have a section (or structure, works both) for "events". On the archive template (see image below) I want to add a custom image in the header. The administrator needs to be able to upload the header ...
1
vote
1answer
161 views

Show products based on custom field

I have a custom field enabled on a product - it is a user field that associates a product with a user. What would the correct setup be to only display products that pertain to the currentUser - as ...
1
vote
1answer
244 views

Custom Field on Settings page

I would like to have a custom field on the general settings page where I can enter the meta description for the website. Can this be achieved somehow? Another way I could think of is to add such a ...
1
vote
1answer
67 views

Non Integer Quantities in Craft Commerce

I am making a custom store that can sell half pounds of items. I've noticed through sending calls through my plugin to the craft()->commerce_cart->addToCart($cart, $itemNumber, $qty); to add an ...
2
votes
1answer
532 views

More than one field for a fieldtype plugin

I can have many 'settings' fields for a fieldType and they're saved as a serialized string in the database. Is it possible to have more than one field for the fieldType itself? It looks like there's ...
1
vote
1answer
59 views

Checking value of customer order field within Plugin

I am trying to check the value of a checkbox as part of my checkout process. I have the following function at the moment. public function init() { craft()->on('commerce_orders....
2
votes
1answer
105 views

Unable to store Model in Commerce Order Fields

I'm trying to use custom order fields in Craft Commerce to store a reference to an object, but all I am getting back is an ElementCriteria model. I have two custom order fields defined: twoDayOption ...
1
vote
0answers
33 views

Is it possible to create a custom field listing all enabled locales?

We have a multilingual site with about 30 different locales and about 5 pages of content for each. We're using Craft as a content API for the editors to manage content. Some of those locales share ...
1
vote
1answer
134 views

How do I set the value of a custom entries order field from a plugin?

I'm trying to set the value of a custom field on an order when saving an entry. I found an example of how to do this for a simple text field, but the field I'm trying to set is an entries field, not ...
1
vote
0answers
46 views

Filter conditions on related UserModel in custom Record

My plugin has a custom ResponseRecord with relations to a UserRecord and ElementRecord as follows: public function defineRelations() { return array( 'user' => array(static::BELONGS_TO,...
1
vote
1answer
432 views

Failed to add a custom field in settings

I'm trying to add a global set, with a Matrix and two required fields for a product. This always works. Now that I am in version 2.6.2791 it fails to add the fields with error: Warning</b> : ...
1
vote
1answer
602 views

Form field validation

I am relatively new to Craft CMS and have been using the formBuilder2 plugin to create forms. No problem this far. I have been able to use ElementApi to output the forms into Json. Still no problem. ...
2
votes
1answer
867 views

Display custom product field in cart

How would I access a custom product field in the cart. I did it with the snapshot attribute like so: {# cart.html #} {% for item in cart.lineItems %} {{ craft.commerce.products.id(item.snapshot....
3
votes
1answer
344 views

How is Craft able to reuse fields in different Sections? (As opposed to EE.)

I'm a HUGE fan of Craft, but I'm wondering how specifically it's able to reuse fields in different sections. I'm very accustomed to an ExpressionEngine environment, where each field's shortname has to ...
1
vote
1answer
634 views

Combining custom field filters on craft.entries

I'm building a book store which filters entries based on GET variables. For the most part, this is working well just merging in various filters to a params variable and then passing craft.entries(...
1
vote
1answer
95 views

How to pull out all user data in a template?

I'm trying to pull out user data in a template for specified user profiles whilst the current user is logged in. To do this I check on the userId being referenced and use: {% if userId != currentUser....
0
votes
1answer
464 views

Allow a dropdown custom field to be edit from a front end form

I want users to be able select their own name prefix/title (Mr, Mrs, Dr. etc) as part of front end form that allows them to update their user details. I have created a custom dropdown field and ...
6
votes
1answer
2k views

How can I update custom order fields in the frontend

I am struggling with using additional custom order fields. (Added in the Craft Commerce settings at "order fields", in the field layout manager) I try to update them like this in the checkout process:...