I have an edit box that has a lookup which defaults to current users records only. We need to change that to display all the records in that particular table for this field. But when we set the filters up, the lookup dialog is showing the records but is auto filling the filed with the first record found... which is not what we want, need it to default to "please select" as does the normal filter do.
the default filter passed to Lookup_Selecting() is:
(0=1) AND (UserId
IN (43))
which shows the current users records
in Lookup_Selecting(), we changed the filter to:
$filter = "UserId
!= ".CurrentUserID();
to show all other records.
it works but when it returns to the function, it auto fills the field with the first record :
ew_AddFilter($sWhereWrk, $sFilterWrk);
if (!$GLOBALS["tbl_A"]->UserIDAllow("add")) $sWhereWrk = $GLOBALS["tbl_B"]->AddUserIDFilter($sWhereWrk);
$this->Lookup_Selecting($this->FIELD_1, $sWhereWrk); // Call Lookup Selecting
if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
$sSqlWrk .= " ORDER BY `FIELD_1` ASC";
$rswrk = Conn()->Execute($sSqlWrk);
==> becomes TRUE if ($rswrk && !$rswrk->EOF) { // Lookup values found
$arwrk = array();
$arwrk[1] = ew_HtmlEncode($rswrk->fields('DispFld'));
$arwrk[2] = ew_HtmlEncode(strtoupper($rswrk->fields('Disp2Fld')));
$arwrk[3] = ew_HtmlEncode(ew_FormatCurrency($rswrk->fields('Disp3Fld'), 0, -2, -2, -2));
$this->FIELD_1->ViewValue = $this->FIELD_1->DisplayValue($arwrk);
} else {
==> need THIS $this->FIELD_1->ViewValue = $Language->Phrase("PleaseSelect");
}
any way to fake it out not to select that first record, already tried adding 0=1, but then the lookup dialog displays no records..
I've set an invalid default value to workaround for the moment.
thanks,
JH