Changing Field Type

12 posts by 4 authors in: Forums > CMS Builder
Last Post: November 30, 2012   (RSS)

Hi,

Backend questions:

Is it possible to change the field from textfield to wysiwyg box for the captions (info1, info2, etc) in the image upload area?

The current character count is limited, I need to expand that, plus have the ability to add html attributes.

Also, is there a way to dynamically add text boxes, much like the way the image upload functions? This pertains to galleries. I want to be able to insert video code in between images, or have a gallery entirely of videos.

I want to be able to add or delete text boxes at will, and use a foreach statement in the frontend to pull the # of boxes.

Does that make sense?

Thanks

Re: [gkornbluth] Changing Field Type

Hi gkornbluth,

Thanks for the pointers. This really helped! I had enough time to tackle the field type.

Files to edit: uploads.ini.php, uploadModify.php, editField.php & style.css

Uploads.ini.php (changed type from varchar to medium text)
[info5]
order = 32
customColumnType = "mediumtext NOT NULL"


Although I can't edit just 1 info field. This would require a lot of code mod. So I just kept it simple and edited the code that will modify all the info fields.

uploadModify.php (from textfield to text area)

$fieldHTML = "<textarea class='text-input1' type='text' name='$formFieldName' cols='70' rows='10' />" .htmlspecialchars($uploadRecord[$infoFieldname], ENT_QUOTES). "</textarea>";

I also removed the character limit of 255.

Next I will be working on the gallery over the weekend.

Many thanks for your help!

Re: [Illume Magazine] Changing Field Type

By gkornbluth - July 13, 2012

Glad it helped,

You mentioned 4 files but only noted the changes you made to 2 of them.

What did you do to the other 2? (editField.php & style.css )

Thanks,

Jerry
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [gkornbluth] Changing Field Type

Hi - I tried this but was getting a mySQL error:

MySQL Error: Data too long for column 'info2' at row 1

Is this easy to sort? Can I do this in PHPMyAdmin?
Thanks
Shannon

Re: [shannonr] Changing Field Type

Sorry Shannon.

I don't know the answer to that one.

Jerry Kornbluth
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [gkornbluth] Changing Field Type

Hello Jerry - thanks for that... (sort of!). So what's the answer to getting more text into the info field - any idea? Did you try this procedure? Anyone else know?
Thanks again
Shannon

Re: [shannonr] Changing Field Type

Hi Shannon,

The changes your currently making will be overwritten if you upgrade CMS Builder at a later date, and we don't provide official support for them.

If you do want to continue, it is possible to increase the character limit of a field using the MySQL console plugin, which is a free plugin you can find here:


http://www.interactivetools.com/add-ons/?user_submitted=1


Once you have installed the plugin, go to the MySQL console link in the plugins section, this will take you to a page where you can run custom MySQL commands. To see the current layout of your upload table use this command:

DESCRIBE cms_uploads

You should find that the character limit of the info1 field is 255 characters. You can increase it using this command:

ALTER TABLE cms_uploads modify info1 VARCHAR(400) ;

Now you should be able to add up to 400 characters of text to the field.

Let me know if you have any problems.

Thanks
Greg Thomas







PHP Programmer - interactivetools.com

Re: [greg] Changing Field Type

Hi Greg - thats brilliant, thanks for the info!...

Re: [shannonr] Changing Field Type

HI - OK, I tried this and the console is telling me I have increased the character limit, but when adding text into the field its still limited to 255 characters. Plus I notice in the console that the NULL flag for the 2 columns I altered is now set to YES.
Also when running a SELECT * FROM cms_uploads LIMIT 100 query, it shows up several entries that I previously deleted (could this be the cause of the NULL value?)
So not out of the woods yet... [:|]