Change field length in drupal unit description - drupal

I'm having trouble using Drupal Rooms module.
This is when I input a description for unit.
Maximum length of Unit description is said to be 255.
I wanna input longer.
I figured out that those are stored in tables - field_data_unit_description_description and field_revision_unit_description_description.
I altered those tables, changed the length of the field to 2048.
But it still says "the text may not be longer than 255 characters."
I tried to change this value in db manually, but it never changed....
If i change the value in the site, the value in db changes, but if i change the value in db, it's not shown in the site.
Please help me.

I solved this problem myself by making a new attribute field for this.
It's quite better way I think since it works well and is fully customizable.
Created a new field in Manage Fields panel, with field attribute : Long Text.
It worked well.

Related

Can you pass pre-defined values to a formio text field from a static query string

I have a simple formio form set up with a basic text field component that I want to pass a value to based on a link a user will click to open the form.
I have tried passing a value with simple URL query string values.
My text field is named projectNumber. Tried passing values with something like this - https://url.com/formpage?projectNumber=project1 but it will not accept the value. I'm sure there is something simple I am missing. I have searched around quite a bit and gone through the formio documentation but have been unable to find anything related to what seems like a fairly simple scenario.
Has anyone else dealt with this situation and found a solution?

drupal move specific field to another field

I basically have a content type named "articles", and in this content type there is a reference field (that let me put unlimited data) called authorsref and a text field which as well let's me add as many as I want.
Both of this fields are called "authors".
What I want to do is move a specific reference field, to the text field, and then delete that reference field.
So for example, there are a hundred articles already, there are actually thousands and let's say 40 of them have a reference field with the author test1 amongst other reference fields and let's say as well that 60 of those hundred articles have as well a reference field of test2.
what I need to do is to somehow go over all the articles and where test1 and test2 reference fields are present, move them from the reference field authorsref to the text field authors.
I am as well a newbie and I have been trying to get this to work for the last three days and I just don't know how.
Please help, and thanks so much!
I think you need to use hook_update_n + batch.
hook_update_n - With this hook you can update some values in your DB.
Batch - you need to use batch for operations that may take a long time. (You don't want to time out PHP, you wont worry about it with batch).
Some examples here and here.

getting textfield output partly unvisible

In a Drupal content type a need to get the output of a field partly unvisible. These are bank account details, the IBAN.
Normally the field shows 1234567. I need to get xxxx567. I need to show only the last 3 numbers/letters.
Also I need this output in field edit form.
On the display end you could change the output using a simple PHP function in the theme template by grabbing a substring of the field's last three digits and concatenating it with "xxxx" before printing.
You might also consider doing this at the formatter level by using the 'custom formatter' module perhaps?
https://drupal.org/project/custom_formatters
To do this on the edit screen is trickier. I suppose you could do a hook form alter to use PHP to change the field value, but I am afraid you will rewrite the field value when you save the node with the 'xxxx' instead of the real data.
I wonder if it would make sense to 1.) hide the actual field, 2.) create a dummy field that displays the text formatted as "xxxx567" to the user, and 3.) write some javascript that populates the hidden field with the visible field's value if it is changed. Presumably the form would still throw values if the hidden field did not meet formatting requirements.

Change Field Type from Int to Float

I'm helping a co-worker with a Drupal (6) issue, but I've never used Drupal before. The client wants to store decimal values in a field that was originally defined as an integer. I can't believe that this isn't possible without losing content or without doing a bunch of SQL copying, but I can't find anything that says, "sure, you can update the field type pretty easily, just do...".
Is this possible? So far:
We've altered the the content_type_thing table so that the _value field is now a float data type rather than an int.
We've updated the content_node_field table so the type value for that field is number_float
Now we can change the value from 1840 to 1840.25 without getting a validation error, but the .25 never gets saved. It gets chopped off and we get 18.00 in the database.
Any ideas?
Thanks.
UPDATE
Before anyone asks, I have read this post, but it looks like the recommendation involves a bunch of data migration. I just can't believe that there's not a way to change the data type in place.
This is pretty straight forward my friend. download this module
http://drupal.org/project/formatted_number
When you install it, go to the content type and change that field to use float.
Actually there is a solution but it's not easy and if you don't know exactly what
you're doing it may have side effects
https://drupal.stackexchange.com/questions/79378/changing-a-field-type-from-integer-to-decimal

What is the purpose and proper use of a textfields max-length property?

What is the purpose and proper use of the max-length property on text fields?
The application I'm working on limits numeric fields to 6 characters... which doesn't work very well for entering millions of dollars... which is why I'm "fixing" it.
MaxLength Sets or receives the maximum number of characters that a user can enter into a Text control.
EDIT: You do this to prevent having to process something that you know is guaranteed to be wrong.
If you have a text field in your database that is set to 10 characters and the user enters 11 and you don't handle it properly, you cause an exception.
So, just set the maxlength to 10 and you won't have any problems like this.
The Maximum length attribute of a text field and/or textarea effectively limits the user from entering data that is outside the bounds and constraints you have set for your database.
You can use this to make sure users enter in valid SKU numbers, blog titles, ISBN numbers, etc. It is a rudimentary form of data validation.
This doesn't always need to be tied to data validation though.
You could want to limit the length of a string that a user has entered for aesthetic reasons when displaying that data on a page in another location.

Resources