# \#laminas-form

**URL:** https://discourse.laminas.dev/tag/laminas-form/43.md

[Latest](https://discourse.laminas.dev/latest.md) · [Categories](https://discourse.laminas.dev/categories.md) · [Tags](https://discourse.laminas.dev/tags.md)

---

## [Best way to use Composition instead of Inheritance for Laminas Form Elements](https://discourse.laminas.dev/t/best-way-to-use-composition-instead-of-inheritance-for-laminas-form-elements/3978)

<div class="topic-metadata">

**Author:** [@earthiverse](https://discourse.laminas.dev/u/earthiverse)\
**Replies:** 6\
**Last updated:** [January 27, 2026, 11:43am UTC](https://discourse.laminas.dev/t/best-way-to-use-composition-instead-of-inheritance-for-laminas-form-elements/3978 "2026-01-27T11:43:34Z")

</div>

Right now we have inputs like this, which extend Select namespace Admin\\Form\\Input; use Admin\\Enum\\PeriodRange as PeriodRangeEnum; use Laminas\\Filter\\ToString; use Laminas\\Form\\Element\\Select; use Laminas\\Validator\\InA…

---

## [Map select INT with String in Global.php?](https://discourse.laminas.dev/t/map-select-int-with-string-in-global-php/3907)

<div class="topic-metadata">

**Author:** [@Jilco](https://discourse.laminas.dev/u/Jilco)\
**Replies:** 1\
**Last updated:** [April 29, 2025, 11:50pm UTC](https://discourse.laminas.dev/t/map-select-int-with-string-in-global-php/3907 "2025-04-29T23:50:20Z")

</div>

In my application the user has to choose several formselects and these return an INT (after jugling). I want to save this INT in the database. For example province in one of my forms: $this-\>add(\[ 'name' =\> 'pr…

---

## [Bind encoded image to form validation](https://discourse.laminas.dev/t/bind-encoded-image-to-form-validation/3902)

<div class="topic-metadata">

**Author:** [@Jilco](https://discourse.laminas.dev/u/Jilco)\
**Replies:** 9\
**Last updated:** [April 23, 2025, 2:10pm UTC](https://discourse.laminas.dev/t/bind-encoded-image-to-form-validation/3902 "2025-04-23T14:10:32Z")

</div>

I downloaded a javascript for resizing images and it works perfect! Only it is returning the cropped image as a JSON/Encoded object. When I decode the data\[1\] and save it in the “traditional” way (fopen/fwrite) everythi…

---

## [Memory usage exceeds limit - with nested fieldsets & doctrine](https://discourse.laminas.dev/t/memory-usage-exceeds-limit-with-nested-fieldsets-doctrine/3857)

<div class="topic-metadata">

**Author:** [@MaSa759](https://discourse.laminas.dev/u/MaSa759)\
**Replies:** 2\
**Last updated:** [February 14, 2025, 11:47am UTC](https://discourse.laminas.dev/t/memory-usage-exceeds-limit-with-nested-fieldsets-doctrine/3857 "2025-02-14T11:47:52Z")

</div>

Hi, I get the error “Memory usage exeeds limit” on validating the form containing nested fieldsets: #0 ...vendor\\laminas\\laminas-cache\\src\\Storage\\Adapter\\AbstractAdapter.php(664): Laminas\\Cache\\Storage\\Adapter\\Memory…

---

## [Form Dependencies - Best practice?](https://discourse.laminas.dev/t/form-dependencies-best-practice/3824)

<div class="topic-metadata">

**Author:** [@jAsgeir](https://discourse.laminas.dev/u/jAsgeir)\
**Replies:** 1\
**Last updated:** [December 20, 2024, 4:14pm UTC](https://discourse.laminas.dev/t/form-dependencies-best-practice/3824 "2024-12-20T16:14:31Z")

</div>

Hello, good people. I simply cannot get my head around form dependencies and how to do it. The problem at hand: Getting data from controller to filter select box options inside a fieldset inside fieldset inside form… …

---

## [Laminas form + upload file + POST Content-Length](https://discourse.laminas.dev/t/laminas-form-upload-file-post-content-length/2253)

<div class="topic-metadata">

**Author:** [@Kriss\_Kals](https://discourse.laminas.dev/u/Kriss_Kals)\
**Replies:** 6\
**Last updated:** [August 6, 2024, 4:47pm UTC](https://discourse.laminas.dev/t/laminas-form-upload-file-post-content-length/2253 "2024-08-06T16:47:41Z")

</div>

Hello. When uploading a file that far exceeds the allowed size before form validation is performed, I get the: Warning POST Content-Length of ... exceeds the limit of ... How can I handle this error?

---

## [Get parent form field-value inside Fieldset-validator](https://discourse.laminas.dev/t/get-parent-form-field-value-inside-fieldset-validator/3736)

<div class="topic-metadata">

**Author:** [@lon9man](https://discourse.laminas.dev/u/lon9man)\
**Replies:** 1\
**Last updated:** [July 24, 2024, 6:34pm UTC](https://discourse.laminas.dev/t/get-parent-form-field-value-inside-fieldset-validator/3736 "2024-07-24T18:34:09Z")

</div>

Hello, what is the suggested way to get parent form values inside validators of fieldset? basic idea: parent form has field parentField form has collection of fieldset depending to this parentField-value of parent for…

---

## [Retrieve form parameter into fieldset](https://discourse.laminas.dev/t/retrieve-form-parameter-into-fieldset/2481)

<div class="topic-metadata">

**Author:** [@ebuddy](https://discourse.laminas.dev/u/ebuddy)\
**Replies:** 8\
**Last updated:** [July 24, 2024, 4:31pm UTC](https://discourse.laminas.dev/t/retrieve-form-parameter-into-fieldset/2481 "2024-07-24T16:31:49Z")

</div>

Hi, I have passed parameters when calling my form in my controller. My form contains a fieldset in wich I need to retrieve data from table according the passed parameters in my form. How can I get those parameters ? H…

---

## [Laminas MVC Framework Course Free for Beginners on Udemy](https://discourse.laminas.dev/t/laminas-mvc-framework-course-free-for-beginners-on-udemy/3728)

<div class="topic-metadata">

**Author:** [@Pulecode](https://discourse.laminas.dev/u/Pulecode)\
**Replies:** 2\
**Last updated:** [July 11, 2024, 9:57am UTC](https://discourse.laminas.dev/t/laminas-mvc-framework-course-free-for-beginners-on-udemy/3728 "2024-07-11T09:57:56Z")

</div>

Hello everyone. I have created a course on Udemy that I wish to give away to beginners who wish to learn how to build a website using the Laminas MVC Framework, MySQL and Bootstrap 5. What you will learn is: how to c…

---

## [Fatal error: Declaration of Commun\\View\\Helper\\FormRowTd::render](https://discourse.laminas.dev/t/fatal-error-declaration-of-commun-view-helper-formrowtd-render/3722)

<div class="topic-metadata">

**Author:** [@ebuddy](https://discourse.laminas.dev/u/ebuddy)\
**Replies:** 6\
**Last updated:** [June 25, 2024, 7:13am UTC](https://discourse.laminas.dev/t/fatal-error-declaration-of-commun-view-helper-formrowtd-render/3722 "2024-06-25T07:13:44Z")

</div>

Hello everyone. I’m back again with my school web application which worked very fine. I do not know why I get this error. I need to say that everything was fine and I regularly update my packages with composer in or…

---

## [Style checkbox as switch](https://discourse.laminas.dev/t/style-checkbox-as-switch/3710)

<div class="topic-metadata">

**Author:** [@oliver681](https://discourse.laminas.dev/u/oliver681)\
**Replies:** 8\
**Last updated:** [June 20, 2024, 10:00am UTC](https://discourse.laminas.dev/t/style-checkbox-as-switch/3710 "2024-06-20T10:00:26Z")

</div>

I want to style a checkbox as a switch, but I don’t know how to achieve this. I’m using bootstrap 4.6.2 and TWBS. I thought something like this would do the trick but it doesn’t. $this-\>add(\[ 'type'…

---

## [Invalid DateTime Keep Coming](https://discourse.laminas.dev/t/invalid-datetime-keep-coming/3699)

<div class="topic-metadata">

**Author:** [@sanjivsharmalv](https://discourse.laminas.dev/u/sanjivsharmalv)\
**Replies:** 13\
**Last updated:** [May 18, 2024, 7:47pm UTC](https://discourse.laminas.dev/t/invalid-datetime-keep-coming/3699 "2024-05-18T19:47:38Z")

</div>

This is how I add element to form in Laminas: // Add "my-date-field" field $this-\>add(\[ 'type' =\> DateTimeSelect::class, 'name' =\> 'my-date-field', 'options' =\> \[ …

---

## [Getting the error - "The input was not found in the haystack"](https://discourse.laminas.dev/t/getting-the-error-the-input-was-not-found-in-the-haystack/3092)

<div class="topic-metadata">

**Author:** [@sanjivsharmalv](https://discourse.laminas.dev/u/sanjivsharmalv)\
**Replies:** 14\
**Last updated:** [November 3, 2022, 12:24pm UTC](https://discourse.laminas.dev/t/getting-the-error-the-input-was-not-found-in-the-haystack/3092 "2022-11-03T12:24:14Z")

</div>

When I use Element\\Select::class in my Form I get this error - “The input was not found in the haystack”. I get this error even when I don not use any validator in my form validation.

---

## [Add validation pattern to form element](https://discourse.laminas.dev/t/add-validation-pattern-to-form-element/3614)

<div class="topic-metadata">

**Author:** [@mimmi20](https://discourse.laminas.dev/u/mimmi20)\
**Replies:** 2\
**Last updated:** [March 1, 2024, 10:06am UTC](https://discourse.laminas.dev/t/add-validation-pattern-to-form-element/3614 "2024-03-01T10:06:17Z")

</div>

We want to validate phone numbers and postal codes. These validations are based on regexes. What is the best way to add these validation patterns as the pattern-Attribute to the form field?

---

## [Translate Laminas\\Validator\\ $messageTemplates](https://discourse.laminas.dev/t/translate-laminas-validator-messagetemplates/3422)

<div class="topic-metadata">

**Author:** [@LordSauron](https://discourse.laminas.dev/u/LordSauron)\
**Replies:** 15\
**Last updated:** [February 8, 2024, 10:17am UTC](https://discourse.laminas.dev/t/translate-laminas-validator-messagetemplates/3422 "2024-02-08T10:17:17Z")

</div>

Hi all, it’s the first time I have to ask a question myself because I wasn’t able to google an answer and ChathGPT was no help either. Please be nice to me, I am neither a developer nor a student. Chef I have learned a…

---

## [Laminas Form View Helper retrieval consistency](https://discourse.laminas.dev/t/laminas-form-view-helper-retrieval-consistency/3591)

<div class="topic-metadata">

**Author:** [@Paul\_McGarry](https://discourse.laminas.dev/u/Paul_McGarry)\
**Replies:** 3\
**Last updated:** [February 1, 2024, 10:59am UTC](https://discourse.laminas.dev/t/laminas-form-view-helper-retrieval-consistency/3591 "2024-02-01T10:59:34Z")

</div>

Hi all. I am trying to understand if the different patterns between some bits of code are intentional, eg: \\Laminas\\Form\\View\\Helper\\AbstractHelper::getDoctypeHelper() protected function getDoctypeHelper(): Doctyp…

---

## [Setting default value of Date FormElement](https://discourse.laminas.dev/t/setting-default-value-of-date-formelement/3581)

<div class="topic-metadata">

**Author:** [@oliver681](https://discourse.laminas.dev/u/oliver681)\
**Replies:** 3\
**Last updated:** [January 17, 2024, 10:38pm UTC](https://discourse.laminas.dev/t/setting-default-value-of-date-formelement/3581 "2024-01-17T22:38:46Z")

</div>

I added a Date FormElement to my form using the following code: $this-\>add(\[ 'type' =\> Date::class, 'name' =\> 'examinationDate', 'options' =\> \[ …

---

## [Fieldset Validation Not Being Applied](https://discourse.laminas.dev/t/fieldset-validation-not-being-applied/3446)

<div class="topic-metadata">

**Author:** [@Saeven](https://discourse.laminas.dev/u/Saeven)\
**Replies:** 6\
**Last updated:** [August 22, 2023, 7:51pm UTC](https://discourse.laminas.dev/t/fieldset-validation-not-being-applied/3446 "2023-08-22T19:51:23Z")

</div>

Hello Laminas Community! I’ve got a simple fieldset that is successfully hydrating the expected entity, however, the validation in that fieldset’s getInputFilterSpecification is being ignored. The fieldset belongs to a…

---

## [Possible Bug validating non-text input](https://discourse.laminas.dev/t/possible-bug-validating-non-text-input/3418)

<div class="topic-metadata">

**Author:** [@juliangorge](https://discourse.laminas.dev/u/juliangorge)\
**Replies:** 14\
**Last updated:** [August 4, 2023, 10:37am UTC](https://discourse.laminas.dev/t/possible-bug-validating-non-text-input/3418 "2023-08-04T10:37:41Z")

</div>

Hey, Just a little bit of context: I’m using OptionalInputFilter into my forms because I have multiple inputs depending of others. For example: if you have to complete a payment form between Bank payment or Credit card…

---

## [Fieldset factory does not triggered](https://discourse.laminas.dev/t/fieldset-factory-does-not-triggered/3429)

<div class="topic-metadata">

**Author:** [@juliangorge](https://discourse.laminas.dev/u/juliangorge)\
**Replies:** 2\
**Last updated:** [August 3, 2023, 8:34am UTC](https://discourse.laminas.dev/t/fieldset-factory-does-not-triggered/3429 "2023-08-03T08:34:56Z")

</div>

Hello, I can not inject my dependencies using a Factory with Fieldset because it looks doesn’t triggered. My module.config.php 'form\_elements' =\> \[ 'factories' =\> \[ Form\\Fieldset\\MyFieldset::class =\> Form\\…

---

## [Rendering multiple nested fieldset in laminas form](https://discourse.laminas.dev/t/rendering-multiple-nested-fieldset-in-laminas-form/2461)

<div class="topic-metadata">

**Author:** [@ebuddy](https://discourse.laminas.dev/u/ebuddy)\
**Replies:** 5\
**Last updated:** [August 3, 2023, 2:19am UTC](https://discourse.laminas.dev/t/rendering-multiple-nested-fieldset-in-laminas-form/2461 "2023-08-03T02:19:05Z")

</div>

Hi everyone. I’m coming back with my fieldset in laminas-form. I have 5 nested fieldsets like this : Impact → Effet → Composante → Produit → Activite I use a loop function to render each element of a fieldset and it …

---

## [How to validate form collections where context between collection elements also needs to be validated](https://discourse.laminas.dev/t/how-to-validate-form-collections-where-context-between-collection-elements-also-needs-to-be-validated/3393)

<div class="topic-metadata">

**Author:** [@oliver681](https://discourse.laminas.dev/u/oliver681)\
**Replies:** 0\
**Last updated:** [July 16, 2023, 3:45pm UTC](https://discourse.laminas.dev/t/how-to-validate-form-collections-where-context-between-collection-elements-also-needs-to-be-validated/3393 "2023-07-16T15:45:54Z")

</div>

I have a form containing a collection financingSources and the corresponding child fieldset FinancingSourceFieldset containing an input share. I want to validate both the respective fieldset’s inputs and the context of t…

---

## [How to display form error in bootstrap style gracefully](https://discourse.laminas.dev/t/how-to-display-form-error-in-bootstrap-style-gracefully/3311)

<div class="topic-metadata">

**Author:** [@jobsfan](https://discourse.laminas.dev/u/jobsfan)\
**Replies:** 7\
**Last updated:** [April 24, 2023, 7:23am UTC](https://discourse.laminas.dev/t/how-to-display-form-error-in-bootstrap-style-gracefully/3311 "2023-04-24T07:23:29Z")

</div>

Is there other ways to add custom class to a form? My related form class(if I wanna to add some attributes like class, can I define it in this part?): class MemberForm extends Form implements InputFilterProviderInterfa…

---

## [Form Fieldset Validation](https://discourse.laminas.dev/t/form-fieldset-validation/3303)

<div class="topic-metadata">

**Author:** [@makxk](https://discourse.laminas.dev/u/makxk)\
**Replies:** 6\
**Last updated:** [April 20, 2023, 8:49am UTC](https://discourse.laminas.dev/t/form-fieldset-validation/3303 "2023-04-20T08:49:41Z")

</div>

Hi everyone! Quick question to make sure I did not miss anything: I have a form with one field and one fieldset consisting of two fields. If one of the fields in the fieldset is filled in by the user, I would like to …

---

## [MVC with one to many relationship](https://discourse.laminas.dev/t/mvc-with-one-to-many-relationship/3132)

<div class="topic-metadata">

**Author:** [@codexknight7](https://discourse.laminas.dev/u/codexknight7)\
**Replies:** 25\
**Last updated:** [December 16, 2022, 9:35pm UTC](https://discourse.laminas.dev/t/mvc-with-one-to-many-relationship/3132 "2022-12-16T21:35:21Z")

</div>

Hello. I am new to Laminas, I installed the framework and I followed up the MVC tutorial, creating a music album. I understood how things work, but I cannot understand how to implement a more advanced thing, like to ad…

---

## [Date field validation](https://discourse.laminas.dev/t/date-field-validation/3180)

<div class="topic-metadata">

**Author:** [@mattG10](https://discourse.laminas.dev/u/mattG10)\
**Replies:** 8\
**Last updated:** [February 16, 2023, 4:28pm UTC](https://discourse.laminas.dev/t/date-field-validation/3180 "2023-02-16T16:28:36Z")

</div>

I have setup a callback validator for a Date field which means it will have an error if another field in the $context has a specific value. I have setup the validation so it works as expected for this error but doing thi…

---

## [Input filter and boolean value](https://discourse.laminas.dev/t/input-filter-and-boolean-value/3069)

<div class="topic-metadata">

**Author:** [@MANDLA\_PILOT\_NKUNA](https://discourse.laminas.dev/u/MANDLA_PILOT_NKUNA)\
**Replies:** 0\
**Last updated:** [October 6, 2022, 5:02am UTC](https://discourse.laminas.dev/t/input-filter-and-boolean-value/3069 "2022-10-06T05:02:26Z")

</div>

I have this two fields one is Normal String the other One is Boolean, I am failing to get the boolean value from API but the string and integer I can get. public function \_\_construct($options = null) { parent::\_\_constr…

---

## [Select form element default value](https://discourse.laminas.dev/t/select-form-element-default-value/3063)

<div class="topic-metadata">

**Author:** [@Francisc\_Tar](https://discourse.laminas.dev/u/Francisc_Tar)\
**Replies:** 6\
**Last updated:** [September 25, 2022, 2:15pm UTC](https://discourse.laminas.dev/t/select-form-element-default-value/3063 "2022-09-25T14:15:29Z")

</div>

How to set the default value for a form select element? I have the following code but is not working. $this-\>add(\[ 'name' =\> 'country', 'type' =\> Form\\Element\\Select::class, 'options…

---

## [How do compare two values of a form in a validator?](https://discourse.laminas.dev/t/how-do-compare-two-values-of-a-form-in-a-validator/3044)

<div class="topic-metadata">

**Author:** [@sanjivsharmalv](https://discourse.laminas.dev/u/sanjivsharmalv)\
**Replies:** 2\
**Last updated:** [September 19, 2022, 7:57am UTC](https://discourse.laminas.dev/t/how-do-compare-two-values-of-a-form-in-a-validator/3044 "2022-09-19T07:57:21Z")

</div>

I have a form that has 2 fields - fromDate and toDate. My implementation is that my validator extends the AbstractValidator and my implementation has the following snippet: \*/ public function isValid($value) {…

---

## [I face the error - 'Class "NumberFormatter" not found ' when I use Element Range](https://discourse.laminas.dev/t/i-face-the-error-class-numberformatter-not-found-when-i-use-element-range/3039)

<div class="topic-metadata">

**Author:** [@sanjivsharmalv](https://discourse.laminas.dev/u/sanjivsharmalv)\
**Replies:** 4\
**Last updated:** [September 13, 2022, 1:36pm UTC](https://discourse.laminas.dev/t/i-face-the-error-class-numberformatter-not-found-when-i-use-element-range/3039 "2022-09-13T13:36:59Z")

</div>

I am facing this error Class “NumberFormatter” when I use Range Element in the form.

[Next page](https://discourse.laminas.dev/tag/laminas-form/43.md?match_all_tags=true&page=1&tags%5B%5D=laminas-form)
