Drupal 7: missing php code in default value - php

I'm using Drupal 7.26 and i created a new content type.
I want to add a field that has a Default value where I can add PHP code. Normally, the Default value shows only plain text.
I have been activating "php filter module" and "cck module" for drupal 7.
But I cannot find the PHP code!!
How do I find this Item? Thank you.

You're looking at it differently.
PHP filter module will provide a text filter in which you would be able to enter php code.
However, the field type in which you add the php code needs to be "Large text" or "Large text with summary". In the field settings you have to enable the PHP filter, then you should be able to enter PHP.

Related

fill out drupal webform automatically

How do I fill out my drupal webform automatically, I have 500 entries to fill out and I can't do it one by one. I try to fill it out automatically directly to phpmyadmin in drupal Database but it doesn't work beacause drupal add more fields in his database (in webform_ submitted_data) so I think it's possible to use a script or use a module to fill it out but I don't know how
The best module to do it, it's webform import very helpful
Allows delimited data files to be imported as submission (results) into webforms.
This is useful for importing submissions from other systems in to Webform. Can also be used to Edit submissions via Export / Import as long as the CSV has the SID column filled.
You can use drupal_form_submit() to submit a webform. See this answer over at drupal.stackexchange.com for instructions.
When you've got that working, it should just be a matter of looping over the webforms you want to fill in.
There is a sandbox module for that: Webform Autofill. But I 've never used it so I can be sure it works.
If you have never used a sandbox module you can see more details at the drupal sandbox modules documentation.

how to add custom input field in limesurvey

Hi I want to add an autocomplete input field in limesurvey but don't know hot accomplish this task. Any one know where to add code for add custom input field?
in autocomplete.js
In this file the code that call a php function on the base of keyup in input field.
in checkInDb.php
In this file the code check term that come from **autocomplete.js** and search in database then send response back to js file
Where to add this code?
In the LimeSurvey documentation it explains very well how to modify the surveys with Javascript.
You don't explain too much, but I think you can find the solution here.

Drupal 7: How to create a text field with php default value?

I've been searching for quite a while now and still wasn't able to find an answer yet.
I'm using Drupal 7.4 and I created a new content type. There i want to add a simple text field that has a Default value where I can add PHP. Normally, the Default value shows only plain text.
To be more specific:
For the users I defined a field_city that they must complete when they sign up.
So for example i would have a user "john" from "Bucharest".
I need to assign the value of field_city - namely Bucharest - to the default value of the text field via PHP (I know how to do this part).
So when john adds new content, he would already have Bucharest printed in that text field but still be able to write whatever other city there.
How could I achieve this?
Can I get away without making a custom module?
Thanx.
Are you using the CCK module for Drupal 7? Although it is still in development status, it will do the trick.

how to add fckeditor to a dynamically creating form in php?

I am creating a dynamic form in php. And i want to add fckeditor to this dynamic form.
so any idea about to add fckeditor to a dynamically creating form in php???
So how can i post values from the fckeditor. That is my actual problem
When i assign text to fckeditor statically using its value property then it stores that in database but when i entered text in fckeditor after execution then it does not save it in database.
What is the problem?
have you added fckeditor on your web page? don't you know how to post form values and save to mysql database?
you have to post fckeditor value then save to mysql database
#Ahmwad Nawaz: I use the jQuery plugin for CKEditor (next version of FCKEditor). See usage here: http://www.fyneworks.com/jquery/CKEditor/#tab-Usage.
If you still wish to create and instantiate the textarea within PHP, when you download the editor it should contain a _samples directory and within that a php directory with several samples in it to show you how to do it.

Customize WebForm module in Drupal

I'm new to Drupal 6.10 CMS and PHP too. I'm creating my website with drupal and I have found a module called Webform I like it, it's pretty easy to create forms with different types of fields and file uploading. The one thing that i can't figure out is how to add Rich Text before all fields. Something like introduction to the form. This module has "Description" field that will show text as a plain text but it doesn't have rich text in it.
What can I use to make that happen. Is it possible to hardcode html there or is there any other modules that can allow to do something like that?
Thanks
the value of the "Description" field is passed through _webform_filter_descriptions(). this function has a $strict parameter, defaulting to TRUE, which determines if the description is filtered through filter_xss() or not. filter_xss() allows some html:
'a', 'em', 'strong', 'cite', 'code',
'ul', 'ol', 'li', 'dl', 'dt', 'dd'
so you can either restrict your "rich text" html to these elements, or modify _webform_filter_descriptions(), setting $strict to FALSE. if you do latter, be aware of the security implications (users with rights to create webform descriptions could enter malicious html - that's what filter_xss() protects against).
I think all you need to do is set the 'input format' to 'full html' and then you can use whatever HTML/CSS tags you want to style the text.
You can achieve this by the creating a Form Component "MARKUP" from the drop down option when creating new fields.
From this part, you are able place html and php in this box as you desire.
You also have the ability to choose input format to have more control over how you want to work with this element.
As the OP says, the "Confirmation" box shows up with the WYSIWYG editor toolbars, but the "Description" box does not.
The simplest way to deal with this is simply to handcode the HTML you want in the Description box. While nowhere does it say you can do this, you can, and it works.
Here is a short howto I wrote on getting custom code to run with Webform.
It details writing a custom module, copying the Webform template to match the nodeID, and adding custom javascript/jquery for form processing.
http://docs.quantact.com/drupal-webform-custom-php-code

Categories