Questions tagged [field]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
2answers
1k views

Matrix loop nesting issue using switch

Anyone know if it's possible to check what the current field is while in a loop of a matrix block? Running into an issue with a matrix block in my loop for how I want to output the content. {% case '...
1
vote
2answers
684 views

Solution to default template with all possible fields and determine position

Banging my head on this one and have not been able to come up with a solution to this. I'm wanting to create a default template for all single entries that checks for all of the fields I have created ...
2
votes
0answers
688 views

Asset dynamic subfolder paths referencing entry section not available until saved

I have an asset field within a matrix block, for which uploads are restricted to a single folder. The upload location path is set to {owner.section.handle}/{owner.slug}. Using this pattern the asset ...
3
votes
2answers
815 views

Creating and using custom content tables

If I want to create fields that get set to a custom content table rather than craft_content how would I do that?
1
vote
0answers
241 views

Get entries using Multi-Select Field as Criteria

When querying for entries, I'm stuck on how to query for "selected" fields. The query I'm using: $criteria = craft()->elements->getCriteria(ElementType::Entry); $criteria->section('athletes'...
1
vote
1answer
251 views

How to create an auxiliary page with sub url?

I have a section where each item has its own URL e.g: news/{slug} The Entry Template for this section is: news/news_detail For each post I would like to have a link to a unique page which is ...
0
votes
1answer
520 views

Frontend Profile - Listing out Radio Buttons

In the official documentation it explains how to let users customize user fields in the frontend, such as: <label for="bio">Bio</label> <textarea id="bio" name="fields[bio]">{{ ...
0
votes
1answer
189 views

Get user field category

I have a matrix that contains a block with a category field. I want to loop over the matrix models, in PHP, to get data. Here's what I have so far: foreach ($user->networksMatrix as $key => $...
3
votes
2answers
1k views

Craft's Content Table

I'm essentially in the process of learning Craft and in that process have made some great strides. Today I was examining Craft's tables to see how it was actually storing fields created through ...
4
votes
3answers
2k views

Search for entries with matrix field's value

I'm building a travel site containing Campaigns (entries) Each of these campaigns has multiple travel dates, modelled by a matrix field of [startDate, endDate, price] I want to do the following ...
1
vote
1answer
707 views

Is it possible to convert a plain text field to a rich text field, without losing content?

I originally had some content stored in a plain text field but I want to give my co-workers the ability to add anchor links, lists etc.. If I were to change the field type form Plaintext to Rich ...
10
votes
2answers
4k views

"Conditional" field layout - hiding or showing fields based on another field

is it somehow possible to conditionally show or hide fields in the entry editor based on the value of another previously entered field? An example of this use would be: A section has Lightswitch ...
3
votes
2answers
369 views

How to check if entry field value is already outputted, and prevent it again?

For an event page I have the option to filter on cities and countries. Each event has entry fields in which the city and country, of which the values are outputted in a drop down list on the front end....
0
votes
1answer
113 views

content and fields won't show up on new single

I just installed Craft, linked it to my database (localhost) and then created a new single "about" page. But when I go to edit the single, there are no fields. I haven't changed anything else! When I ...
0
votes
2answers
2k views

Getting Attribute for Homepage

I have created a field for the homepage called icon_font. I now want to access that field in my template. What is the best way to do that? Do I have to use a for loop (even though there is only one ...
2
votes
1answer
905 views

Dynamically iterate over a matrix block's fields?

Is there a way to dynamically iterate over a matrix block's fields such that the template doesn't need to know the field handles? This doesn't work: {% for block in entry.myMatrixField %} {% for ...
3
votes
2answers
2k views

Clarification on UID creation

I have a series of matrix blocks that use a ton of the same fields and was hoping I could simply duplicate them in the database and update the context and id of the fields. It'd be a LOT faster this ...
4
votes
1answer
441 views

How do I select a default in the Position Select field?

Just getting around to adding advanced layout features to our site, when I say advanced I just mean floated images left & right. The problem I seem to have though is that left is always the ...
1
vote
1answer
590 views

How can I get a lightswitch to work with order() in craft.entries?

I'm getting mixed results when using a lightswitch field together with order('RAND()') and I wonder if I'm doing something wrong. For example, this code gives me the correct results: craft.entries....
2
votes
1answer
2k views

Can I change TEXT to MEDIUMTEXT/LONGTEXT in database?

I have a text field in my database in which I'm going to index the contents of a PDF file. Right now the database column for that field is defined as "TEXT" but I need more space since my PDF files ...
5
votes
2answers
2k views

Programatically Adding Fields to a Layout

I am looking to add a field (or perhaps a group?) to the userlayout via a database migration. I've looked over the docs, and found Is it possible to add a custom field to User model from a plugin? ...
2
votes
1answer
95 views

Find all empty fields in admin

I'm working with a fairly large data set in one of my channels and I was hoping there was a way maybe in admin to show me all the live entries where certain fields are empty. I want to be able to ...
2
votes
1answer
923 views

Field type for selecting a section (channel / structure / single)?

I have a channel for products but in some cases I would like to associate a product with a structure containing documentation and release note pages: http://mysite.com/product/my-product/docs/getting-...
0
votes
1answer
3k views

Image asset not being displayed

This is my second website I am building with craft cms and I have no prior experience with Twig. I have had a particular issue with echoing image assets from a singles entry. The line I copied from ...
1
vote
1answer
2k views

getting fields of a section (getFields())

I feel like I'm doing this wrong (looping on section fields): {% for fieldLayoutField in craft.entries.section('rentalsBulletin').getEntryTypes().first.getFieldLayout().getFields() %} {% set ...
0
votes
1answer
579 views

Searching members fields [closed]

I'm building a Users search page. I want to search the members group based on the following fields that I've setup for Users: First Name Last Name Company Name (handle: genericCompany, type: Plain ...
2
votes
1answer
2k views

Fetch values for a single field across all entries in a section

I have a section "Hotel Room" with a field "Sleeps" (number). There is no limit on the values that can be entered. On the frontend I want a list of all existing entered values for this field. So if I ...
3
votes
1answer
662 views

Query for blocks across Block Types using the new field parameter?

This is a great new feature of Craft 2.3: It is now possible to set custom field parameters on Matrix block queries. I was wondering what would happen, if two or more Matrix Block Types had a ...
1
vote
1answer
186 views

Global-only fields adding columns to content table?

I understand the rationale of adding one column per custom field to the craft_content table in the database; but why would this happen for fields that are only used once globally? Is there a way to ...
4
votes
1answer
290 views

Entries retain field data that has been removed from entry type layout

I have a single page section titled "About". At one point, I had assigned a "text" Rich Text field to the entry type layout. I then put some filler text in this field and saved the entry. Later I ...
0
votes
1answer
233 views

Assets Content/Fields not available until entry is saved?

I've got Asset location setup with a Photo Caption field. And a Photo Gallery field which references said Asset. When creating a new entry, I'm uploading images to the Photo Gallery field. When the ...
2
votes
1answer
1k views

Set site locale to display correct date format in date/time field

The date field is displaying dates in US format (mm/dd/yyyy) but I need the UK (dd/mm/yyyy) format. According to the docs: Dates and times are both formatted for the user’s preferred locale. They ...
1
vote
1answer
1k views

How to get a list of fields on an entry

How do you get a list of the fields that are on an entry? I tried {{ dump(entry.subentry) }} but that isn't any help ...
2
votes
1answer
84 views

Page breaks when editing a field

I'm suddenly having issues with multiple Craft builds on my local dev environment. Basically, everything else is working fine but when I edit a field the page breaks. It appears to only be displaying ...
1
vote
1answer
1k views

How do you output the value of a checkbox item?

Seems like it should be simple but it's not working for me. {% for option in entry.contributionType %} <li> {{ option.value }} </li> {% endfor %} This code outputs the option's ...
2
votes
1answer
1k views

Displaying a list of fields in a form select

In a plugin's settings view, I'm looking to show a list of fields to choose from: {% set fields = craft.fields.getAllFields() %} {{ forms.selectField({ label: 'Salary Mapping'|t, ...
2
votes
1answer
477 views

How to process CSV files within a Matrix field?

I'm trying to import and process CSV data within a matrix field. My situation is the following: I have a matrix field with one block and several fields inside. One of these is an asset field to ...
1
vote
1answer
270 views

Is it possible to define a 'richtext' fieldtype as 'MEDIUMTEXT' in DB?

Some articles are very long and getting cut off when saved to the database. Is it possible to define a 'richtext' fieldtype as 'MEDIUMTEXT', or would I have to write a plugin to replicate the '...
4
votes
2answers
2k views

How do I find the closest parent entry with an Assets field filled in?

I have a structure that goes up to 4 levels deep. Each page has a field for a 'hero' image. If a child page does not have this field filled out I would like to traverse up the structure and find the ...
1
vote
1answer
443 views

Front end edit required asset

Since file inputs are not allowd to be pre-populated, how do i tell craft that a required asset field is already filled in the front end edit form? Can’t seem to figure this one out. Edit: Users can ...
2
votes
1answer
362 views

Required fields in the user profile

how to make required plane text fields or required firsrtName and lastName fields in users profile? I want to during the registration and profile changes were required. Maybe there is any plugin for ...
1
vote
3answers
199 views

How to use required fields on localised entries?

I'm building a multi-lingual site and have found Craft's locales / translatable fields useful for setting up structures where each page will have a translated version. However, for at least one of the ...
5
votes
1answer
1k views

How to clear the database of unused fields?

I have one section with different entry types. One entry type uses two matrix fields, another one only one, and so on. Since the frontend layout is always the same, I use one template for the whole ...
1
vote
2answers
685 views

Plain text field - apostrophes are getting escaped

I have a plain text field in Craft and the content has an apostrophe. On the front end, the apostrophe gets turned into &#039; Not ideal! Thanks in advance..
12
votes
1answer
7k views

How to display all fields belonging to current entry?

How do I modify a template to include a loop that displays all custom fields that I added to the field group that the current entry belongs through? I know how to display the fields individually by ...
7
votes
3answers
2k views

Default field values?

This seems so simple, but after reading over the docs, I couldn't find an answer: Is there a way to have a field have a default value in Craft? In my case, I have a Lightswitch field that I want to ...
0
votes
2answers
1k views

Entry field not outputting after {% set... %} code in template

I have an {entry.footer} field outputting just fine everywhere before {% set entry... %} Added {% endset %} tags after closing anchor tag and caused an error. Any idea what the issue is? {% extends "...
2
votes
1answer
642 views

Matrix fields within a plugin?

I'm just starting to explore the whole power of Craft and I'm really satisfied with its possibilities so far. But I can't get one thing done, so here's my question: Is it possible to use matrix ...
1
vote
1answer
462 views

Rich Text Field Adding Tags around script

I'm trying to add some embed code/script and the rich text field on save puts misc <p> tags around my code. How do I save code so it keeps it's code formatting without adding an extra stuff?
5
votes
1answer
217 views

Entry with many fields vs plugin/custom data structure

i'm just getting my feet wet with craft and would appreciate some pointers. Basically, what i would like to do is show and compare products. Each product will have a description, price, review, and ...