HREF Field with lookup table and multiple display fields

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.

HREF Field with lookup table and multiple display fields

Postby tberg » Fri Jan 12, 2018 12:51 am

I have a field address_id that is lookup table from address table. The display fields are address, city, state, zip. I want this field to be a link to google maps. For view tag I have the following:
HREF Field: address_id
Original field value: <unchecked>

This works fine in List and View pages. But in Edit page I get the following warning at the top of the page:
Notice: Array to string conversion in C:\xampp\htdocs\wwdb\phpfn14.php on line 7007

I am using v2018.0.6.

Thanks,
Todd
tberg
 
Posts: 7
Joined: Mon Jul 31, 2017 11:53 pm

Re: HREF Field with lookup table and multiple display fields

Postby arbei » Fri Jan 12, 2018 10:08 am

Can you post the code around 7007 here?

Also, post your settings for the Edit Tag for the field.
arbei
 
Posts: 1490
Joined: Wed Sep 09, 2015 10:13 am

Re: HREF Field with lookup table and multiple display fields

Postby tberg » Sun Jan 14, 2018 2:34 am

Edit Tag
Select
Use Lookup Table
Tablename: address
Link field: id
Display field #1: address
Display field #2: city
Display field #3: zip

phpfn14.php:
Around 7007 is this function:
// Remove HTML tags from text
function ew_RemoveHtml($str) {
return preg_replace('/<[^>]*>/', '', strval($str));
}

Which is used by this function:
// Get select options HTML
function SelectOptionListHtml($name = "") {
global $Language;
$emptywrk = TRUE;
$curValue = (CurrentPage()->RowType == EW_ROWTYPE_SEARCH) ? ((substr($name,0,1) == "y") ? $this->AdvancedSearch->SearchValue2 : $this->AdvancedSearch->SearchValue) : $this->CurrentValue;
$str = "";
if (is_array($this->EditValue)) {
$arwrk = $this->EditValue;
if ($this->FldSelectMultiple) {
$armultiwrk = (strval($curValue) <> "") ? explode(",", strval($curValue)) : array();
$cnt = count($armultiwrk);
$rowswrk = count($arwrk);
$emptywrk = TRUE;
for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
$selwrk = FALSE;
for ($ari = 0; $ari < $cnt; $ari++) {
if (ew_SameStr($arwrk[$rowcntwrk][0], $armultiwrk[$ari]) && !is_null($armultiwrk[$ari])) {
$armultiwrk[$ari] = NULL; // Marked for removal
$selwrk = TRUE;
$emptywrk = FALSE;
break;
}
}
if (!$selwrk)
continue;
foreach ($arwrk[$rowcntwrk] as $k => $v)
$arwrk[$rowcntwrk][$k] = ew_RemoveHtml(strval($arwrk[$rowcntwrk][$k]));
$str .= "<option value=\"" . ew_HtmlEncode($arwrk[$rowcntwrk][0]) . "\" selected>" . $this->DisplayValue($arwrk[$rowcntwrk]) . "</option>";
}
} else {
if ($this->UsePleaseSelect)
$str .= "<option value=\"\">" . $this->PleaseSelectText . "</option>";
$rowswrk = count($arwrk);
$emptywrk = TRUE;
for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
if (ew_SameStr($curValue, $arwrk[$rowcntwrk][0]))
$emptywrk = FALSE;
else
continue;
foreach ($arwrk[$rowcntwrk] as $k => $v)
$arwrk[$rowcntwrk][$k] = ew_RemoveHtml(strval($arwrk[$rowcntwrk][$k]));
$str .= "<option value=\"" . ew_HtmlEncode($arwrk[$rowcntwrk][0]) . "\" selected>" . $this->DisplayValue($arwrk[$rowcntwrk]) . "</option>";
}
}
if ($this->FldSelectMultiple) {
for ($ari = 0; $ari < $cnt; $ari++) {
if (!is_null($armultiwrk[$ari]))
$str .= "<option value=\"" . ew_HtmlEncode($armultiwrk[$ari]) . "\" selected>" . $armultiwrk[$ari] . "</option>";
}
} else {
if ($emptywrk && strval($curValue) <> "")
$str .= "<option value=\"" . ew_HtmlEncode($curValue) . "\" selected>" . $curValue . "</option>";
}
}
if ($emptywrk)
$this->OldValue = "";
return $str;
}
tberg
 
Posts: 7
Joined: Mon Jul 31, 2017 11:53 pm


Return to General Discussion (PHPMaker)