- Posts: 92
COMMUNITY FORUM
Allowing HTML in Extra Fields Default Settings
- Red Evolution
-
Topic Author
- Offline
- Premium Member
Less
More
15 years 3 months ago #77885
by Red Evolution
Allowing HTML in Extra Fields Default Settings was created by Red Evolution
Hi,I can now post HTML in extra fields when adding an item by implementing this small hack.However, I want to set some raw HTML as the default value in extra fields. I've looked at the extrafield.php and extrafields.php files in the admin/models folder but can't see where these can be hacked to allow raw HTML.Any help appreciated.d
Please Log in or Create an account to join the conversation.
- GWS-Desk
-
- Offline
- New Member
Less
More
- Posts: 9
15 years 3 months ago #77886
by GWS-Desk
Replied by GWS-Desk on topic Allowing HTML in Extra Fields Default Settings
"I want to set some raw HTML as the default value in extra fields"
can you give an example what you want to achieve?
Leo 8)
can you give an example what you want to achieve?
Leo 8)
Please Log in or Create an account to join the conversation.
- Red Evolution
-
Topic Author
- Offline
- Premium Member
Less
More
- Posts: 92
15 years 3 months ago #77887
by Red Evolution
Replied by Red Evolution on topic Allowing HTML in Extra Fields Default Settings
Yeah, I want to add an HTML JavaScript URL call as the default field data.
GWS-Desk said:"I want to set some raw HTML as the default value in extra fields"
can you give an example what you want to achieve?
Leo 8)
GWS-Desk said:"I want to set some raw HTML as the default value in extra fields"
can you give an example what you want to achieve?
Leo 8)
Please Log in or Create an account to join the conversation.
- Panagiotis
-
- Offline
- New Member
Less
More
- Posts: 11
13 years 11 months ago #77888
by Panagiotis
Replied by Panagiotis on topic Allowing HTML in Extra Fields Default Settings
If i understand your question you want to add a default value to an extrafield. What i m trying to do but i cannot figure out how, is to add a simple php condition as a value to an extrafield default value. This condition may check another value or a session variable and simply display a message as a default extrafield value...
Any help?
Thanks
Any help?
Thanks
Please Log in or Create an account to join the conversation.
- Odin Mayland
-
- Offline
- Platinum Member
Less
More
- Posts: 404
13 years 9 months ago #77889
by Odin Mayland
Replied by Odin Mayland on topic Allowing HTML in Extra Fields Default Settings
I would like to do this too.
Please Log in or Create an account to join the conversation.
- Panagiotis
-
- Offline
- New Member
Less
More
- Posts: 11
13 years 9 months ago #77890
by Panagiotis
Replied by Panagiotis on topic Allowing HTML in Extra Fields Default Settings
Lets say for ex. that if you want to "pass" a value to "title" form field which is not an extrafield but a default field in the K2 form.php, then you might do something like this:
<input class="text_area" type="text" size="35" name="title" id="title" maxlength="250" value="<?php if ($datatitle!="") $this->row->title=$datatitle; echo $this->row->title; ?>" />
Where $datatitle is perhaps a session variable that comes to form.php from another php...
In my case $datatitle is a variable that gets its value from a text file into form.php like this:
$datatitle = file_get_contents($ntitledata);
<input class="text_area" type="text" size="35" name="title" id="title" maxlength="250" value="<?php if ($datatitle!="") $this->row->title=$datatitle; echo $this->row->title; ?>" />
Where $datatitle is perhaps a session variable that comes to form.php from another php...
In my case $datatitle is a variable that gets its value from a text file into form.php like this:
$datatitle = file_get_contents($ntitledata);
Please Log in or Create an account to join the conversation.
- Odin Mayland
-
- Offline
- Platinum Member
Less
More
- Posts: 404
13 years 9 months ago #77891
by Odin Mayland
Replied by Odin Mayland on topic Allowing HTML in Extra Fields Default Settings
Josh's past allowed me to put code into the extrafield textarea box:
Open up Administrator/components/com_k2/models/extrafield.php
//line 32 - replaced if (!$row->bind(JRequest::get('post',JREQUEST_ALLOWHTML))) //around line 53 - replaced $objects = array (); $values = JRequest::getVar('option_value','','post','string',JREQUEST_ALLOWRAW); $names = JRequest::getVar('option_name','','post','string',JREQUEST_ALLOWRAW);
See whole discussion here: community.getk2.org/forum/topics/adding-html-code-into-extra?commentId=3536014%3AComment%3A314491&xg_source=msg_com_forum
Open up Administrator/components/com_k2/models/extrafield.php
//line 32 - replaced if (!$row->bind(JRequest::get('post',JREQUEST_ALLOWHTML))) //around line 53 - replaced $objects = array (); $values = JRequest::getVar('option_value','','post','string',JREQUEST_ALLOWRAW); $names = JRequest::getVar('option_name','','post','string',JREQUEST_ALLOWRAW);
See whole discussion here: community.getk2.org/forum/topics/adding-html-code-into-extra?commentId=3536014%3AComment%3A314491&xg_source=msg_com_forum
Please Log in or Create an account to join the conversation.