Keyword

Default values in extra fields if using editor?

  • Coptechs
  • Coptechs's Avatar Topic Author
  • Offline
  • Junior Member
More
12 years 1 month ago #102616 by Coptechs
I have a few extra fields set up as textarea and I have checked the "Use editor" feature. However, in the back end, when trying to set default values for those extra fields, no editor is visible and it will not allow html, only plain text. Am I missing something or is there a way to do this?

Please Log in or Create an account to join the conversation.

More
12 years 1 month ago #102617 by Lefteris
Hi. There is no support for HTML in the default text for editors. You can enable it by modifying the file /administrator/components/com_k2/models/extrafield.php and change line 56 from:
$values = JRequest::getVar('option_value');

to:
$values = JRequest::getVar('option_value', '', 'default', 'none', 4);

Note that the editor will still no render in the extra field edit page and you will have to add the code by yourself. Also note that only basic HTML is allowed there.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Coptechs
  • Coptechs's Avatar Topic Author
  • Offline
  • Junior Member
More
12 years 1 month ago - 12 years 1 month ago #102618 by Coptechs
Lefteris-

I got it partially working after the modification you suggested. I enter the following html code as a default value for an extra field:
<p>Call 845-507-0046 <a href="mailto:[email protected]"> email [email protected]</a> or <a href="contact-us">click here to use our online inquiry form.</a>
</p>

It displays properly in back end when creating an article. However, when I view the article in front end, it looks like this:

Call 845-507-0046 '; document.write(''); document.write(addy_text83682); document.write('<\/a>'); //-->\n or click here to use our online inquiry form.


Any other thoughts?

Please Log in or Create an account to join the conversation.

More
12 years 1 month ago #102619 by Lefteris
Is the code actually saved? Maybe your editor is stripping the code. Also note that you can only type simple HTML code, any script code will be stripped.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Coptechs
  • Coptechs's Avatar Topic Author
  • Offline
  • Junior Member
More
12 years 1 month ago #102620 by Coptechs
Well I am using JCE as my editor and the code I copied and pasted is from the code view in the editor. It is just a "mailto" link that isn't working, would that not be considered simple HTML?

Please Log in or Create an account to join the conversation.

More
12 years 1 month ago #102621 by Lefteris
Yes but in the code you provided there is a javascript call ( document.write). Also try to check the editor settings. Finally update Joomla!/K2/JCE to their latest stable versions.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Coptechs
  • Coptechs's Avatar Topic Author
  • Offline
  • Junior Member
More
12 years 1 month ago #102622 by Coptechs
That is the weird thing, I have no idea where that javascript call is coming from. I'm not putting it in there and it doesn't show in the back end code view.

I can't find any settings that could be affecting it in JCE and everything is up to date. I just launched the site a few weeks ago as a Joomla 2.5 site.

Please Log in or Create an account to join the conversation.

More
12 years 1 month ago #102623 by Lefteris
Try to disable the editor and use just the textarea. Then paste your code there and hit apply. Does any part of it gets stripped?

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Coptechs
  • Coptechs's Avatar Topic Author
  • Offline
  • Junior Member
More
12 years 1 month ago #102624 by Coptechs
Disabling the editor in the extra field and just leaving the HTML code works. I guess I will leave it at that since I don't have to do any real fancy stuff in the extra field. Thanks so much for your help.

Please Log in or Create an account to join the conversation.

More
12 years 4 weeks ago #102625 by Lefteris
You are welcome. Note that this means that the editor is stripping the code, not K2. Anyway, if the textarea is fine for you, go with it.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum