<p>Ok worked out a solution to the attributes. You can set them like this:</p>

<pre><code>array(AttributeType::String, 'column' =&gt; ColumnType::Text,  'required' =&gt; false)
</code></pre>

<p>By defining the column, so hopefully this will help someone else.</p>

CC BY-SA 3.0
2016-05-15T13:24:38.797Z
Can't thank you enough @lettie for this! I had no idea I could set ColumnType, has saved me a massive headache!
Merlin
CC BY-SA 3.0
2015-05-14T12:29:16.513Z
2015-05-14T12:29:16.513Z
Lettie
<p>I am having a problem with record and model attribute types.</p>

<p>I have a frontend user form with some textfields which require a TEXT type field in the database to hold the data. So far I have tried setting the attribute type to String which creates a varchar(255) which isn't big enough to hold the data.</p>

<p>I've also tried Mixed which creates the TEXT type but does not populate the data when the form is submitted. Reading further and based on a previous problem I had I think this is due to the lack of validation on the Mixed attribute.</p>

<p>So my question is how do I get my form to submit this data if the attribute I create is causing the</p>

<pre><code>$record-&gt;setAttributes($model-&gt;getAttributes());
</code></pre>

<p>to ignore the Mixed fields data. Or is there another attribute that would work better something like Text?</p>

<p>Also what would be useful to know is if there is any resource which describes the different attributes with examples of how to set them up for records and models as I can't seem to find anything that describes this process clearly.</p>

<p>Any help much appreciated.</p>

<p>Cheers</p>

<models><records><attribute>
What attribute type should I set in the record or model to create a TEXT type in the database?
# What attribute type should I set in the record or model to create a TEXT type in the database?

(Asked by: username_0 on 2015-05-14)

I am having a problem with record and model attribute types.
I have a frontend user form with some textfields which require a TEXT type field in the database to hold the data. So far I have tried setting the attribute type to String which creates a varchar(255) which isn't big enough to hold the data.
I've also tried Mixed which creates the TEXT type but does not populate the data when the form is submitted. Reading further and based on a previous problem I had I think this is due to the lack of validation on the Mixed attribute.
So my question is how do I get my form to submit this data if the attribute I create is causing the
$record->setAttributes($model->getAttributes());

to ignore the Mixed fields data. Or is there another attribute that would work better something like Text?
Also what would be useful to know is if there is any resource which describes the different attributes with examples of how to set them up for records and models as I can't seem to find anything that describes this process clearly.
Any help much appreciated.
Cheers

**Tags:** models, records, attribute

---

## 1 answers

### Answer by username_0 on 2015-05-14. Score: 14

Ok worked out a solution to the attributes. You can set them like this:
array(AttributeType::String, 'column' => ColumnType::Text,  'required' => false)

By defining the column, so hopefully this will help someone else.

> **Comments:**
> **username_1**: Can't thank you enough @lettie for this! I had no idea I could set ColumnType, has saved me a massive headache!  

---

