Skip to main content
Share Your Experience: Take the 2024 Developer Survey
5 votes

Math with numeric values derived from a dropdown field

Have you tried subhead.hLevel.value?
Oli's user avatar
  • 7,495
4 votes
Accepted

Dropdown field 'default'

Yes, if you don't include the dropdown field in your entry form, Craft will store the default value for that field, if one has been set. If no default value has been set, then the value will be null.
Steve Rowling's user avatar
4 votes

Is it possible to use an existing field into a matrix?

You can use the neo Plugin or you can copy and paste the field settings manually from one field to your matrix field in your database interface. In your craft_fields table there is a column settings ...
Robin Schambach's user avatar
4 votes
Accepted

Is there a way for a user to assign another user to a group on the frontend?

Assuming you're using the core users/save-user action to edit users (as per the official User Profile form example) you can add a form input named groups to save group assignments from the frontend ...
Mats Mikkel Rummelhoff's user avatar
3 votes

Is there a way for a user to assign another user to a group on the frontend?

Why not just provide them with access to the backend, with only the permissions they need? Anyway, if you need to provide a custom form in the frontend, you can write a form similar to the example in ...
MoritzLost's user avatar
  • 11.4k
3 votes
Accepted

Calculating a score based on a drop down field value

When working with a dropdown in Twig, it's important to remember that you're dealing with an object (not a simple string). This is an object: {{ entry.myDropdown }} It's easy to forget, however, ...
Lindsey D's user avatar
  • 24k
3 votes

Use value of a dropdown field for an `include`

You don't need to (more specifically, you can't) nest Twig tags within other Twig tags. Ditch the inner Twig tag and its respective quotes, and just pass the variable directly into the outer Twig tag.....
Lindsey D's user avatar
  • 24k
3 votes
Accepted

Front End Form with Dropdown in Matrix - Adding New

Your Code has two errors: 1. was missing. 2. The way you were fetching options was wrong. Here is the correct code: <input type="hidden" name="fields[emergencyContact]" value=""> <input ...
hashtagerrors's user avatar
3 votes
Accepted

Add Checked Attribute to Custom User Fields on Frontend User Form

Solved! {% for letter in currentUser.newsletters.options %} <input type="checkbox" value="{{ letter.value }}" name="{{ letter.value }}" id="{{ letter.value }}" {% if letter.selected == ...
Chattervast's user avatar
2 votes
Accepted

Using a Dropdown field in a Matrix to parse a global

UPDATE: Knowing your use case I would use a dropdown as you were inside your matrix block and then query what the chosen value was and output the relevant global field. {% if block.dropdownValue == '...
Luke Pearce's user avatar
  • 3,863
2 votes
Accepted

Drop-down and checkbox in a condition

A checkboxes field returns an array of models, that you can inspect using {{ dump(sourceCountry) }} in your loop. The model has a __toString method that outputs the checkbox value when you output the ...
carlcs's user avatar
  • 36.3k
2 votes
Accepted

Select dropdown not going to option url

What you're currently seeing is the correct URL for a GET form submission. You'll need to update the onsubmit handler to construct the URL you wish to visit, based on the selected option. Here's how ...
Stephen Lewis's user avatar
2 votes

How to print all possible options of a dropdown field inside of a Matrix field?

This can be done like so... {% set matrix = craft.app.fields.getFieldByHandle('myMatrixField') %} {% for field in matrix.blockTypeFields if field.handle=='myDropdownField' %} <select> {...
foamcow's user avatar
  • 2,029
2 votes
Accepted

Craft 3: fetching a single Matrix row by its dropdown field value

That is most likely happening because usage is ambiguous for your logos field, so Craft isn’t sure which column to assign the condition to. If you give the usage field within your img block type a ...
Brandon Kelly's user avatar
2 votes

Field dropdown - default value is not working in CMS

The default value will only apply to newly created entries. Existing entries won't have any saved value for this field. You're only seeing the first value as selected in your entry edit screen because ...
MoritzLost's user avatar
  • 11.4k
1 vote

Filter entries on dropdown field value

Dropdown fields support filtering by selected option values, so you should be able to do something like this: {% for item in entry.children .dropdownField('value') .all() %} Note you need to ...
MoritzLost's user avatar
  • 11.4k
1 vote
Accepted

Show specific values when dropdown is select

At the risk of this question being closed for being too broad, there are a couple ways to handle this. Unlike other CMS such as WordPress, in Craft CMS, the front end code is up to you. If you don't ...
RitterKnight's user avatar
  • 6,582
1 vote

Sort Entries by Value from Dropdown

Apologies to the community for doubling-up on Answers. OP clarified that indeed they were looking to group based on a Dropdown field, which changes the approach somewhat (and side-steps any eager-...
August Miller's user avatar
1 vote

Sort Entries by Value from Dropdown

Edit: I've misunderstood the question! It sounds like Schools aren't related Elements, but just a dropdown value? I think there are a couple of missteps, here: The .group() method on a UserQuery ...
August Miller's user avatar
1 vote
Accepted

Dropdown field value getting outputted multiple times

You don't need the for loop in this case. What's happening is you're looping over each option in your dropdown field, and each time it's checking the value of the dropdown and displaying white or ...
Jalen Davenport's user avatar
  • 3,045
1 vote
Accepted

LJ Dynamic Fields - Only Seeing Latest 100 entries

By default Craft 2 will only return 100 elements (entries, assets, users, etc.) at a time. If you want to get more than that, you need to use limit(null). {% for channel in craft.entries.section('...
Brad Bell's user avatar
  • 67.5k
1 vote
Accepted

Translatable dropdown menu

It does it per default: public function getInputHtml($value, ElementInterface $element = null): string { return Craft::$app->getView()->renderTemplate('_includes/forms/select', [ '...
Robin Schambach's user avatar
1 vote
Accepted

error when trying to loop through grouped entries according to dropdown field

You have to remove the entry from your entry.resourceType {% set allEntriesByCat = allEntries|group('resourceType') %} will work
Robin Schambach's user avatar
1 vote

Front End Form with Dropdown in Matrix - Adding New

I don't think I have a specific answer, but I can point you to a few posts that I think will help get you rolling. How are you creating a new row for your matrix field? Get a matrix editor into ...
Damon's user avatar
  • 4,706
1 vote
Accepted

How do I eager load a dropdown field?

Dropdowns are not relations, and therefore they don't need to be eager loaded (and indeed can't be eager loaded). Here's an explanation of what's going on under the hood with eager loading: Speed up ...
andrew.welch's user avatar
  • 11.6k
1 vote
Accepted

Reuse chosen dropdown field value on frontend

i've got now a working approach to my question above: {% set field = craft.fields.getFieldByHandle('jahrgang') %} <form action="tourdefrance.html" method="post"> <select class="dropdown" ...
TomS's user avatar
  • 213
1 vote

Simple Search form with a few drop-down choices

This should get you headed in the right direction: https://www.webstoemp.com/blog/combined-searches-and-filters-craft-cms/
user5920's user avatar
1 vote

Simple Search form with a few drop-down choices

I would probably create some categories for make, color and transmission and relate every entry to it. Then you have the ability to use craft.entries... to fetch the entries as you need them. You can ...
Johannes's user avatar
  • 740
1 vote
Accepted

How can I get spaces to render in my dropdown option label template call?

It turns out this was happening because i'd set some values for my content and then changed the structure of the field. I just reset the values for my content and all was well.
mrtobo's user avatar
  • 43
1 vote

Using a Dropdown field in a Matrix to parse a global

If I'm understanding the question properly, you have a dropdown field in a matrix block that lets the user pick out which phrase they want to spit out on the page. The actual content of that phrase is ...
RitterKnight's user avatar
  • 6,582

Only top scored, non community-wiki answers of a minimum length are eligible