Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [form]

The tag has no usage guidance.

1
vote
1answer
23 views

How to validate a form request

Is there anything with craft like Laravel's Form Requests? I am writing a plugin with a custom entry type. Right now, I am doing the store/edit pages and I do not want to reinvent the wheel ;) Is ...
1
vote
2answers
33 views

Convert checkbox values from an array to a string

I have a front end form with multiple checkboxes. Is it possible to convert the checkbox values from an array to a string before it's submitted to the database? I want to save the checkbox values ...
9
votes
1answer
2k views

How do you delete assets from a frontend form?

I am creating a proof of concept for a client in Craft where the client's customers can manage projects from the frontend of a Craft install. I have a frontend form working correctly for creating a ...
1
vote
0answers
25 views

Craft 3: Possible to merge checkbox and text values from a frontend form and put into a plaintext Craft field?

Is it possible to submit checkbox array and text values on a front end form into a plaintext Craft field in Craft 3? My solution worked in Craft 2 but it broke in Craft 3 due to some under the hood ...
1
vote
2answers
87 views

Looking for a advanced form plugin for CraftCMS

I'm currently using amforms from a&m impact on a couple of sites. However, it looks like this plugin won't get a craftcms version 3 update. In addition, my requirements for a form plugin have ...
2
votes
2answers
15 views

How to process POST and entry fields when using same form for Add as Edit on front end?

I use the same form for adding an entry on the front end as I do for editing it. So when editing it, we need to insert the field values in the fields. When editing or adding it we also need to re-...
2
votes
1answer
71 views

Add Dynamic Elements In Forms

I'm needing to add a dynamically added dropdown input field for my form, as is commonly done with javascript. How would this be possible? In other words, there may be more than 1 dropdown desired by ...
2
votes
0answers
16 views

Asset Upload Form Field Error States

I currently have an asset upload field, but I'm trying to make it call errors back if the image isn't an extension that's set within the field, allowing users to understand why the form didn't save. ...
1
vote
1answer
60 views

Craft 3 Registration Form Success Redirect

Is it possible to redirect the user to a specific page after they successfully complete the front-end registration form (before activation)? I've tried adding: <input type="hidden" name="action" ...
1
vote
1answer
19 views

Front End Entry Form Select Dropdown Error

My front-end new entry form works, but when I add the complexity of a dropdown to the mix - it error's and doesn't save the entry. (I found this out with trial and error, removing fields until I found ...
1
vote
1answer
56 views

AJAX CSRF Producing Inconsistent Results

I am using CSRF tokens in a form on CraftCMS. Submissions are successful with a standard configuration. Introducing "fresh" CSRF tokens via AJAX on page load is causing some trouble. This is ...
2
votes
2answers
352 views

Update form entry using the Guest Entries plugin

I am trying to create a form that anyone can submit regardless if they are logged in or not. I found the Pixel & Tonic Guest Entries plugin for this. Now that I've installed and configured the ...
1
vote
1answer
127 views

Craft Commerce 2 Ajax Add to Cart

Trying to ajax add to cart but each submit returns a https://www.website.com/commerce/cart/updateCart 404 (Not Found) I have this in my twig template: {% for book in craft.products().type('books')....
1
vote
0answers
48 views

How can I create a Module/Plugin to edit multiple entries via a single front-end form in Craft 3?

Scenario: I have a Structure section called Competitions that allows users to submit one or more (usually three maximum) entries to judged photo competitions. However, they can only submit one or two ...
1
vote
0answers
25 views

Error message regarding password in user registration form

I have a custom registration form in my Craft site based on this info. https://docs.craftcms.com/v2/templating/user-registration-form.html And I want to show error message when the password doesn't ...
2
votes
1answer
40 views

How Do You Add A Form on a Page to Gate the Content?

I am new to Craft, but one of my clients has a website built in Craft. They would like to "gate" the content on a page of their website. A. Is it possible to gate content in the Craft CMS? Client ...
1
vote
1answer
22 views

hashing form fields to prevent tampering

I have a front end form for entry creation. I have a few options I don't want tampered with. The docs for |hash say "Prefixes the given string with a keyed-hash message authentication code (HMAC), for ...
1
vote
1answer
24 views

User Account Form Dropdown

I have a Countries dropdown menu for signing up that i didn't have before. It used to just be a text field where they can input their own country. It works on the front end sign up form properly, but ...
1
vote
2answers
33 views

Create web report able to be exported in pdf

I'm new in the Craft CMS world, and I'm approaching it because I need to create a web app where I and my colleague can create reports based on what we do for customers and export them in PDF format. ...
2
votes
1answer
222 views

How can I get a user to choose in which group he registers using the User Registration Form

Is there a way to allow a registrant to choose a user group in the registration form? I tried using the following code but it didn't work: <input type="hidden" name="userGroups" value="3">
1
vote
1answer
31 views

How to handle form submissions?

So I am coming from WordPress and typically I would typically handle a post by either hooking into the wp_post action and access the $_POST request that way. Now I believe Craft is built on Yii which ...
4
votes
1answer
2k views

Is it possible to change a user's password in the front-end?

Is it currently possible to change a user's password in for example the profile edit form? I'm currently using the forgot password approach for this.
1
vote
1answer
68 views

Login form redirect not working

My login form is not redirect like I want it to. <form method="post" accept-charset="UTF-8"> {{ csrfInput() }} <input type="hidden" name="action" value="users/login"> <input type="...
0
votes
0answers
56 views

Craft 3: Custom “Set Password Form” not working

I'm trying to make a custom page for setting a new password. I found the following in the docs: https://docs.craftcms.com/v3/dev/examples/set-password-form.html I created a file called setpassword....
1
vote
1answer
168 views

Another AJAX CSRF question

I have quite a simple registration form, something like this: <script type="text/javascript"> window.csrfTokenName = "{{ craft.config.get('csrfTokenName') }}"; window....
1
vote
1answer
92 views

Translating Craft form error message labels

I am trying to change the label for Craft's form errors. My site local is currently fr_CA, and when I try to submit a form with an error, the error message returned is in french, but the label of the ...
1
vote
2answers
111 views

Sprout Form Date/Time field not displaying

I'm working on an inherited site where I have a sprout form and am adding additional fields. I have added a date/time field to the form with the settings in this screenshot. In my template where all ...
3
votes
2answers
1k views

Integrate Google reCAPTCHA into Contact Form plugin

So I just recently plugged in pixelandtonic/ContactForm plugin into my website and I realized I got about 3 spam emails straight into my inbox on the first day it was up. Is there a way to integrate ...
3
votes
1answer
116 views

Sprout Form redirect after submit not working correctly

All my forms on sprout form won't use the redirect they get assigned via the Form builder. Whenever a form is succesfully submited it redirects to my homepage instead of my thank-you page. <form ...
2
votes
2answers
120 views

Craft Commerce: make address phone telephone field required without JavaScript

Because I used a similar address model to the one supplied in the Craft Commerce templates, which essentially uses the same form partials for both address and billing, and also hides and shows the ...
5
votes
1answer
1k views

Getting server-side feedback when submitting forms with jQuery Form plugin

I've got a few simple front-end forms that users can use to update their profiles. I'm using the combo of the jQuery Validate and Form plugins to handle validation and submission. I can successfully ...
3
votes
2answers
3k views

What is the best way to append CSRF token without using a form?

I have built a plugin that simply makes requests to a 3rd party API. I am calling my plugin action via ajax. I don't have a form on this page currently. Here is what I am using, but I am getting the ...
0
votes
0answers
37 views

Form in Front End Template Reference Plugin for LDAP

I am a Craft newbie, and I'm currently making a few custom templates, learning Twig, etc. My question is: in including a form in my template code, how would the form be coded (Twig or HTML)? Is there ...
1
vote
1answer
66 views

How I can capture previous and current URL to a hidden form field

I need to create a hidden form field and populate the previous and current URL can someone tell me how I can do that in Craft.
2
votes
1answer
101 views

User make assets subfolder in the frontend

I have a standard user profile form. But now I would like that the user can upload images in new subfolder and make own subfolder. Is there any solution or a plugin for this?
1
vote
0answers
45 views

Is the Craft Queue suitable for processing form submissions?

I am looking to queue my form submissions to be processed in the background. I want to be able to only keep user data in the system/database as long as required. This will mean keeping it to debug it ...
1
vote
2answers
209 views

Craft Commerce — Billing / Shipping Address validation / required Fields

As default Craft has only First Name and Last Name as required. Is it possible to set more as this two fields as required fields? And is it also possible to set custom Fields as required too?
0
votes
0answers
50 views

Is it possible to send other fields with Form Builder 2?

I'm using Form Builder 2 on Craft 2, to send forms/emails but in my case I want to send fields/data within the "form" tag other than those who are defined in the plugin setting. Here are the fields ...
1
vote
1answer
617 views

How to call Controller in Module?

I'm very new to craft and I'm having trouble finding an answer to my question (I've scoured the questions on here - but the only answers appear to be for plugins). Basically, I want to submit a form ...
1
vote
1answer
77 views

How to make combination of two field values unique?

I make use of the front-end entry form for an event registration process. The event is the main entry, and every event registration an entry of a related registration section. The challenge is to see ...
1
vote
2answers
300 views

Generate pdf with form submission data

I'm using amforms for a client and need to create a user confirmation email that has a pdf attached containing the submitted form data, like a receipt. After a little google searching, I believe I'd ...
1
vote
0answers
67 views

Front End New Entry Form

I am trying to create a form that allows users to rate a restaurant (which is another section) by creating a "userRatings" section entry. userRatings has three fields: a dropdown field called ratings, ...
2
votes
1answer
727 views

How do I search craft.entries with multiple parameters?

I'm filtering entries based off a searchbar with multiple parameters, and I'm building up an entries filter based off of them. Everything works great except for having more than one .search functions. ...
0
votes
1answer
92 views

Serialization of 'Closure' is not allowed

I created a form on the frontend that allows users to upload their profile photos: <form method="post" accept-charset="UTF-8" enctype="multipart/form-data"> {{ csrfInput() }} <input ...
0
votes
0answers
76 views

Intermittent BAD REQEUST CSRF Token Could not be verified - Form Builder 2

I am doing normal post requests with the Form Builder 2 plugin and have run into an odd issue with CSRF tokens. I have a custom form template where I echo the call to the CSRF token in my twig ...
2
votes
1answer
933 views

Customizing front-end login/logout redirects

I have "manage" link that redirects to domain.com/login. "login" is custom front-end page that after logging in redirects to homepage. After logging in when I click "manage" again the domain.com/login ...
1
vote
1answer
346 views

frontend form action: save as draft or publish

in my frontend entry form I have a "save as draft" submit button. The current action for this form is the following, which saves the entry submitted through the form as a draft (status: disabled): &...
1
vote
1answer
120 views

How to reference an entry field in a guest user form?

I'm new to Craft. I've been trying to wrap my head around how to design the concept of Events and Event Registrations. Currently I have both Events and Event Registrations as their own Sections as ...
3
votes
4answers
2k views

Robust Form Plugins for Craft?

We're doing a rebrand and web overhaul for a Christian camp, retreat, and conference center. A big part of the site is a registration system where people can register for an event, fill out a detailed ...
1
vote
1answer
93 views

Pass variable in Twig tag

My template has this line that I want to update from a field in craft: {% set form = craft.formBuilder2.getFormByHandle('schoolTrip') %} I want 'schoolTrip' to be replaceable by a plain text field ...