Jump to content

replace repeater with table field - how to keep HTML tags?


Recommended Posts

Hi all,

I am trying to copy some existing data stored in a repeater field "itemlist" to a ProFields table "itemtable" using this PHP snippet:

include("./index.php"); // bootstrap PW

$page_name = "apage.html";

$p = wire("pages")->get("name=$page_name");

if($p) {
	foreach($p->itemlist as $item) {
		if($item->il_code != '') {
			echo "<p>Element " . $item->il_code . " : " . $item->il_desc . " belongs to page " . $page_name . "</p>";
			$new_row = $p->itemtable->makeBlankItem();
			$new_row->code = $item->il_code;
			$new_row->desc = $item->il_desc;
			$new_row->avail = $item->il_avail;

Basically that works well - problem is that all HTML tags get removed when storing the text fields in the table. I have checked to make sure that no textformatters are specified in columns settings of that table. Are there any additional sanitizers etc. I need to take care of when dealing with such table fields?

TIA, HerTha

Link to comment
Share on other sites

  • 8 months later...

Well, I realized that another approach (using PageTable) was actually more suitable for my specific needs, so I did not dig any deeper into the above issue. I believe it has been brought up somewhere in the ProFields support area, though.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...