Why won't my very simple stack work in HTML5?
Posted: Mon Jan 29, 2024 6:49 pm
I'm new here. Been using Livecode for years, and I've had success in the past with simple test stacks compiled for HTML5 but I'm running into a problem with a simple stack for converting the date to a special format I like and outputting it to a field.
The stack consists of a button, a field, and 2 functions that work fine in the LC IDE. But when compiled and run via a browser - nothing.
I also notice that copy and paste commands don't work in HTML versions.
Can anyone tell me what I'm overlooking? My button script is :
on mouseUp
get secsToMyLongStamp(the secs)
set the clipBoardData to it
put it into fld 1
end mouseUp
and my functions are as follows:
function secsToMyLongStamp tSecs
put tSecs into tDate
put tSecs into tTime
convert tDate to short date
put myNumFormat(tDate) into tDate
set twelveHourTime to false
convert tTime to long time
set the itemDelimiter to ":"
put item 1 of tTime & item 2 of tTime & item 3 of tTime into tTime -- remove colons
if tDate = "not a date" then return tDate else return tDate & "@" & tTime
end secsToMyLongStamp
function myNumFormat input
if input is not a date then -- error
return "not a date"
exit myNumFormat
end if
convert input to short date -- ex., "8/6/15", in case it is not
set the itemDelimiter to "/"
put item 3 of input into stamp -- the year
get item 1 of input
if the number of chars in it = 1 then put "0" before it
put "-" & it after stamp -- the month
get item 2 of input
if the number of chars in it = 1 then put "0" before it
put "." & it after stamp -- the day
return stamp
end myNumFormat
In the IDE the result would be "24-01.29@104727" (for an example)
In the browser version, nothing happens at all.
See :
https://wildcard.on-rev.com/my/Emscript ... yDate.html
The stack consists of a button, a field, and 2 functions that work fine in the LC IDE. But when compiled and run via a browser - nothing.
I also notice that copy and paste commands don't work in HTML versions.
Can anyone tell me what I'm overlooking? My button script is :
on mouseUp
get secsToMyLongStamp(the secs)
set the clipBoardData to it
put it into fld 1
end mouseUp
and my functions are as follows:
function secsToMyLongStamp tSecs
put tSecs into tDate
put tSecs into tTime
convert tDate to short date
put myNumFormat(tDate) into tDate
set twelveHourTime to false
convert tTime to long time
set the itemDelimiter to ":"
put item 1 of tTime & item 2 of tTime & item 3 of tTime into tTime -- remove colons
if tDate = "not a date" then return tDate else return tDate & "@" & tTime
end secsToMyLongStamp
function myNumFormat input
if input is not a date then -- error
return "not a date"
exit myNumFormat
end if
convert input to short date -- ex., "8/6/15", in case it is not
set the itemDelimiter to "/"
put item 3 of input into stamp -- the year
get item 1 of input
if the number of chars in it = 1 then put "0" before it
put "-" & it after stamp -- the month
get item 2 of input
if the number of chars in it = 1 then put "0" before it
put "." & it after stamp -- the day
return stamp
end myNumFormat
In the IDE the result would be "24-01.29@104727" (for an example)
In the browser version, nothing happens at all.
See :
https://wildcard.on-rev.com/my/Emscript ... yDate.html