Javascript problem - I think
This has been driving me mad all day. I am using the V11 Dialog component with 20 buttons displayed on the form, the function shown obtains the
required data to be displayed on each button which works fine, but it also obtains an image (tbl11.thumbnail) which is displayed on a textbox set
as an image display type.This is where the problem starts as the path name from the image reads [PathAlias.ADB_Path]Thumbnailsimage.png
and not what I would expect [PathAlias.ADB_Path]\Thumbnails\image.png
I have tried filename_encode(???) and that also returns c:progamthumbnailsimage.png
The path on the DB is correct so it seems to be in the {dialog.Object}.setValue('"+DISPLAY_IMAGE+"','"+tbl11.thumbnail+"');
I know that javascript does not like the \ symbol which is why 'I think' I have this situation.
Has anyone out there encounted this problem? and are willing to share their findings
'--------------------------------------------------------------------------------
function loadpageshift as c (e as p)
dim jscmd as c
dim button as c
dim unique as c
dim Desc as c
dim tbl11 as p
dim number as c
dim display_image as C
i = 0 'Button/Ref Number/Display Description start number
w = 95 'Image start number
number = session.CB+alltrim(convert_type(e._currentrowdatanew.dia_type,"c"))
tbl11 = table.open("[PathAlias.ADB_Path]\products.dbf",FILE_RW_SHARED)
tbl11.order("unique","type = \""+number+"\"")
tbl11.fetch_first()
WHILE .not. tbl11.fetch_eof()
i = i + 1
w = w + 1
DISPLAY_IMAGE = "TEXTBOX"+convert_type(w,"c")
button = "BUTTON_"+convert_type(i,"c")
unique = "TEXTBOX"+convert_type(i,"c")
desc = "DESC"+convert_type(i,"c")
if convert_type(e._currentrowdatanew.switchproducts,"c") = "1"
jscmd = jscmd + "{Dialog.Object}.setValue('"+BUTTON+"','"+tbl11.description_hold+"');dialog.Object}.setValue('"+UNIQUE+"','"+tbl11.unique+"');dialog.Object}.setValue('"+DESC+"','"+tbl11.description+"');"
else
if tbl11.display_image = "1" .or. tbl11.active = "ACTIVE"
if tbl11.active = "ACTIVE"
jscmd = jscmd + "{dialog.Object}.setValue('"+DISPLAY_IMAGE+"','"+tbl11.thumbnail+"');{dialog.Object}.setValue('"+BUTTON+"','');{dialog.Object}.setValue('"+UNIQUE+"','"+tbl11.unique+"');{dialog.Object}.setValue('"+DESC+"','"+tbl11.description+"');"
else
jscmd = jscmd + "{dialog.Object}.setValue('"+DISPLAY_IMAGE+"','"+tbl11.thumbnail+"');{dialog.Object}.setValue('"+BUTTON+"','');{dialog.Object}.setValue('"+UNIQUE+"','"+tbl11.unique+"');{dialog.Object}.setValue('"+DESC+"','"+tbl11.description+"');"
end if
else
jscmd = jscmd + "{dialog.Object}.setValue('"+BUTTON+"','"+tbl11.description+"');{dialog.Object}.setValue('"+UNIQUE+"','"+tbl11.unique+"');{dialog.Object}.setValue('"+DESC+"','"+tbl11.description+"');"
end if
end if
if i = 20
exit while
end if
tbl11.fetch_next()
end while
tbl11.close()
loadpageshift = jscmd
end function
'---------------------------------------------------------------------------------
This has been driving me mad all day. I am using the V11 Dialog component with 20 buttons displayed on the form, the function shown obtains the
required data to be displayed on each button which works fine, but it also obtains an image (tbl11.thumbnail) which is displayed on a textbox set
as an image display type.This is where the problem starts as the path name from the image reads [PathAlias.ADB_Path]Thumbnailsimage.png
and not what I would expect [PathAlias.ADB_Path]\Thumbnails\image.png
I have tried filename_encode(???) and that also returns c:progamthumbnailsimage.png
The path on the DB is correct so it seems to be in the {dialog.Object}.setValue('"+DISPLAY_IMAGE+"','"+tbl11.thumbnail+"');
I know that javascript does not like the \ symbol which is why 'I think' I have this situation.
Has anyone out there encounted this problem? and are willing to share their findings
'--------------------------------------------------------------------------------
function loadpageshift as c (e as p)
dim jscmd as c
dim button as c
dim unique as c
dim Desc as c
dim tbl11 as p
dim number as c
dim display_image as C
i = 0 'Button/Ref Number/Display Description start number
w = 95 'Image start number
number = session.CB+alltrim(convert_type(e._currentrowdatanew.dia_type,"c"))
tbl11 = table.open("[PathAlias.ADB_Path]\products.dbf",FILE_RW_SHARED)
tbl11.order("unique","type = \""+number+"\"")
tbl11.fetch_first()
WHILE .not. tbl11.fetch_eof()
i = i + 1
w = w + 1
DISPLAY_IMAGE = "TEXTBOX"+convert_type(w,"c")
button = "BUTTON_"+convert_type(i,"c")
unique = "TEXTBOX"+convert_type(i,"c")
desc = "DESC"+convert_type(i,"c")
if convert_type(e._currentrowdatanew.switchproducts,"c") = "1"
jscmd = jscmd + "{Dialog.Object}.setValue('"+BUTTON+"','"+tbl11.description_hold+"');dialog.Object}.setValue('"+UNIQUE+"','"+tbl11.unique+"');dialog.Object}.setValue('"+DESC+"','"+tbl11.description+"');"
else
if tbl11.display_image = "1" .or. tbl11.active = "ACTIVE"
if tbl11.active = "ACTIVE"
jscmd = jscmd + "{dialog.Object}.setValue('"+DISPLAY_IMAGE+"','"+tbl11.thumbnail+"');{dialog.Object}.setValue('"+BUTTON+"','');{dialog.Object}.setValue('"+UNIQUE+"','"+tbl11.unique+"');{dialog.Object}.setValue('"+DESC+"','"+tbl11.description+"');"
else
jscmd = jscmd + "{dialog.Object}.setValue('"+DISPLAY_IMAGE+"','"+tbl11.thumbnail+"');{dialog.Object}.setValue('"+BUTTON+"','');{dialog.Object}.setValue('"+UNIQUE+"','"+tbl11.unique+"');{dialog.Object}.setValue('"+DESC+"','"+tbl11.description+"');"
end if
else
jscmd = jscmd + "{dialog.Object}.setValue('"+BUTTON+"','"+tbl11.description+"');{dialog.Object}.setValue('"+UNIQUE+"','"+tbl11.unique+"');{dialog.Object}.setValue('"+DESC+"','"+tbl11.description+"');"
end if
end if
if i = 20
exit while
end if
tbl11.fetch_next()
end while
tbl11.close()
loadpageshift = jscmd
end function
'---------------------------------------------------------------------------------
Comment