I use a frontend plugin to insert data into the database. Via Typo3 (TCA) the record can be viewed in Backend.
The problem:
If there are breaks in the textarea from the frontend form its displayed inside the record like this:
test\r\ntest\r\ntest
What i already tried are different kind of escaping, nl2br, explodes, and so on.
How does the database-field should look like, so the breaks are displayed well?
Here is some code:
'note' => array(
'exclude' => 0,
'label' => 'LLL:EXT:mq_eventform/locallang_db.xml:tx_XYZ_data.note',
'config' => array(
'type' => 'text',
'cols' => '30',
'rows' => '5',
)
),
$field_values = array(
'note' => mysql_real_escape_string($_REQUEST['note']),
);
You need to use TCA type 'none' for backend. But this field is not editable.
'note' => array(
'exclude' => 0,
'label' => 'LLL:EXT:mq_eventform/locallang_db.xml:tx_XYZ_data.note',
'config' => array(
'type' => 'none',
'cols' => '30',
'rows' => '5',
'pass_content' => true,
)
),
And you need to use nl2br() function while storing value to database.
$field_values = array(
'note' => nl2br($_REQUEST['note']),
);
Related
so basically on my wordpress site, i link images and i recently changed my image domain name, so i went into phpmyadmin and typed:
UPDATE `wp_postmeta` SET `meta_value` = replace(meta_value, 'old-domain.com', 'new-domain.com')
and my mysql/phpmyadmin, its all updated to the new domain, but on wordpress, the custom field hasnt picked up the new details and is left blank.
this is my array for the custom field:
'title' => 'Embed Image',
'pages' => array( 'post' ),
'tabs' => array(
'input-version' => array(
'label' => 'Input Version',
'icon' => 'dashicons-admin-customizer',
),
'tab_style' => 'default',
'fields' => array(
array(
'id' => 'ab_embedgroup',
'type' => 'group',
'clone' => true,
'sort_clone' => true,
'save_state' => true,
'desc' => '<b style="color:red;">Insert embed code</b>',
'tab' => 'input-version',
'fields' => array(
array(
'name' => 'Host Name',
'id' => 'ab_hostname',
'type' => 'text',
),
array(
'name' => 'IMEmbed',
'id' => 'ab_embed',
'type' => 'textarea',
'sanitize_callback' => 'none',```
cleared cache, restarted VPS, tried it all, just cant understand why it wont pick it up.
am i editing it incorrectly? Cant do it one by one because its a few thousand images.
I want to show a grid or editable table in my tab in the admin section
I managed to do the module and three tabs are been displayed .In one of the tab i want to show a editable grid i.e in the CHECKS tab
As shown in the below image,in the chek tab section i want to show a grid
In the constructor of my admin controller of my module ()
ie in addhealthcheckconfig\controllers\admin\HealthCheckConfigController.php
I am setting the field options to populate the tab ,below is my code:
$this->fields_options = array(
'appearance' => array(
'title' => $this->l('Manage your Health Check '),
'icon' => 'icon-html5',
'tabs' => array(
'TAB1' => $this->l('SUPPORT_GROUPS'),
'TAB2' => $this->l('CHECKS'),
'TAB3' => $this->l('REPORT RECIPIENTS'),
),
'fields' => array(
'SUPPORT_GROUPS' => array(
'title' => $this->l('SUPPORT GROUPS'),
'hint' => $this->l('Manage your Support Groups here'),
'type' => 'fields_list',
'name' => 'PS_LOGO',
'tab' => 'TAB1'
),
'CHECKS' => array(
'title' => $this->l('LIST OF AVAILABLE CHECKS '),
'hint' => $this->l('List of Available checks will be displayed here !!'),
'type' => 'text',
'list' => $this->fields_list = array(
'code' => array(
'title' => $this->l('code'),
'align' => 'text-center',
'remove_onclick' => true,
'search' => false,
),
'description' => array(
'title' => $this->l('description'),
'align' => 'text-center',
'remove_onclick' => true,
'search' => false,
),
'category' => array(
'title' => $this->l('category'),
'align' => 'text-center',
'remove_onclick' => true,
'search' => false,
),
),
'tab' => 'TAB2'
),
'REPORT_RECIPIENTS' => array(
'title' => $this->l('REPORT RECIPIENTS '),
'hint' => $this->l('List of Available checks will be displayed here !!'),
'tab' => 'TAB3'
),
) ));
In the TAB2 Section i am not sure what i need to put in the 'type' section , I tried with list , but yet I can not achieve what I am trying to do , also i am not sure how to assign the $this->fields_list to that type correctly
How to achieve this editable db grid in my tab ?
I have been trying to create an attribute for the categories in magento at the backend through programmatically. So, I followed steps in http://www.hesselbom.net/magento-custom-attributes-with-selectbox and it works perfectly and even I can able to save the selected values. Whereas, if I try creating a text box attribute, the values is not getting saved. Can anyone guide me how to do this?
Following is my code.
$installer->addAttribute('catalog_category', 'custom_textfield', array(
'type' => 'varchar',
'label' => 'Custom field',
'input' => 'text',
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
'visible' => TRUE,
'required' => FALSE,
'default' => ''
));
$attributeId = $installer->getAttributeId($entityTypeId, 'custom_textfield');
I have also updated the version in the config file accordingly.
Please try with it work for me
$installer->addAttribute('catalog_category', 'custom_textfield', array(
'group' => 'General',
'input' => 'text',
'type' => 'varchar',
'label' => 'Custom field ',
'backend' => '',
'visible' => 1,
'required' => 0,
'user_defined' => 1,
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
));
$this->addAttribute('catalog_category', 'custom_textfield', array(
'group' => 'General',
'type' => 'varchar',//can be int, varchar, decimal, text, datetime
'backend' => '',
'frontend_input' => '',
'frontend' => '',
'label' => 'Custom Field',
'input' => 'image', //text, textarea, select, file, image, multilselect
'class' => '',
'source' => '[source model for attribute here]',//this is necessary for select and multilelect, for the rest leave it blank
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,//scope can be SCOPE_STORE or SCOPE_GLOBAL or SCOPE_WEBSITE
'visible' => true,
'frontend_class' => '',
'required' => false,//or true
'user_defined' => true,
'default' => '',
'position' => 100,//any number will do
));
This should do the trick. :)
After a long search, I found it. Below is the way to create and save attribute value at the admin panel.
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$setup->addAttribute('catalog_category', 'length_waterline_custom', array(
'group' => 'General',
'input' => 'text',
'type' => 'varchar',
'label' => 'Length of Waterline',
'backend' => '',
'visible' => 1,
'required' => false,
'user_defined' => 1,
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
));
$eavConfig = Mage::getSingleton('eav/config');
First of all excuse my bad english.
I got a problem with my select-field in the BE. I would like to prefill (preselect) all of the available items.
Code in ext_tables.php:
'teilnehmer' => array(
'exclude' => 0,
'label' => 'LLL:EXT:kiwanisext/Resources/Private/Language/locallang_db.xlf:tx_kiwanisext_domain_model_veranstaltung.teilnehmer',
'config' => array(
'type' => 'select',
'foreign_table' => 'fe_users',
'MM' => 'tx_kiwanisext_veranstaltung_user_mm',
'size' => 10,
'autoSizeMax' => 30,
'maxitems' => 9999,
'multiple' => 0,
'wizards' => array(
'_PADDING' => 1,
'_VERTICAL' => 1,
'edit' => array(
'type' => 'popup',
'title' => 'Edit',
'script' => 'wizard_edit.php',
'icon' => 'edit2.gif',
'popup_onlyOpenIfSelected' => 1,
'JSopenParams' => 'height=350,width=580,status=0,menubar=0,scrollbars=1',
),
'add' => Array(
'type' => 'script',
'title' => 'Create new',
'icon' => 'add.gif',
'params' => array(
'table' => 'fe_users',
'pid' => '###CURRENT_PID###',
'setValue' => 'prepend'
),
'script' => 'wizard_add.php',
),
),
),
),
I found nothing helpful in the documentation.
Any hint, tip or help will be much appreciated!
Its not possible to do that with plain TCA config, afaik. You can however define a default value wich will be selected (if none is defines, 1st item will be selected).
'default' => 'myValue'
But to preselect multiple values at once, you have to use JavaScript I guess.
This code worked for me in typo3 6.2. I have a selectbox filled with database records.
I want the records with ID's 1 ans 2 to be preselected in the selectbox:
'thematique' => array(
'exclude' => 0,
'label' => 'LLL:EXT:dk_actus/locallang_db.xml:tx_dkactus_thematique',
'config' => array(
'type' => 'select',
'foreign_table' => 'tx_dkactus_thematique',
'foreign_table_where' => 'ORDER BY tx_dkactus_thematique.uid',
'size' => 10,
'minitems' => 0,
'maxitems' => 99,
'default' => '1,2',
),
),
Im using Drupal version 6.19 and the webform module in Drupal to create forms.I have two forms on my site.When the user submits the form, where in the drupal database are the entries saved for each form ?
Please help
Thank You
Just take a look at its database schema in webform.install.
...
$schema['webform_submitted_data'] = array(
'description' => 'Stores all submitted field data for webform submissions.',
'fields' => array(
'nid' => array(
'description' => 'The node identifier of a webform.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'sid' => array(
'description' => 'The unique identifier for this submission.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'cid' => array(
'description' => 'The identifier for this component within this node, starts at 0 for each node.',
'type' => 'int',
'size' => 'small',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'no' => array(
'description' => 'Usually this value is 0, but if a field has multiple values (such as a time or date), it may require multiple rows in the database.',
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '0',
),
'data' => array(
'description' => 'The submitted value of this field, may be serialized for some components.',
'type' => 'text',
'size' => 'medium',
'not null' => TRUE,
),
),
'indexes' => array(
'nid' => array('nid'),
'sid_nid' => array('sid', 'nid'),
),
'primary key' => array('nid', 'sid', 'cid', 'no'),
);
...
You should use:
First, log in to mysql
After, use database_name;
You must replace with the name of the database
Then, show tables;
The last sentence will show you the tables of tha database
Now, select * from webform_submitted_data;
You should be able to see the data.
You can also view submitted data by navigating to Content Management > Webforms. I believe the data is serialized in the database, so if you have large forms its not an easy read.