Author |
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: January 08 2008 at 20:54 | IP Logged
|
|
|
Since we have so many nifty new ways of doing things, I'd like to know what the current best method is for evaluating formulas.
I have been using the JavaScript SK function from long ago...
Code:
function sk(value)
{ document.execsendkeys.sendkeys.value = value; document.execsendkeys.submit(); } |
|
|
Then I call it with something like this in a button...
Code:
onclick="sk('ph_rtne( ph_insteon( \'OUTSIDE HOLIDAY\', ifastoff, 0 ))')" |
|
|
I'm pretty sure there is a better way these days.
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: January 15 2008 at 17:31 | IP Logged
|
|
|
Tony,
There are indeed several new ph-cgi functions (I see another post coming soon documenting these ) but to just execute a standard PowerHome formula, the preferred method would be with a /ph-cgi/evalformula function. It works exactly like the execsendkeys function but does not require the ph_rtne function to make sure that keystrokes are not generated.
So, the missing part would be an HTML form probably called evalformula rather than execsendkeys. The action of this form would be /ph-cgi/evalformula. The parameter required would also need to be changed from "sendkeys" to formula. With that in place your sk function would look like this:
Code:
function sk(value)
{document.evalformula.formula.value = value; document.evalformula.submit();} |
|
|
and then call it like this:
Code:
onclick="sk('ph_insteon(\'OUTSIDE HOLIDAY\',ifastoff,0)')" |
|
|
All in all, not much simpler, but definately the preferred way since we're not actually trying to send keystrokes.
HTH,
Dave.
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: January 15 2008 at 19:16 | IP Logged
|
|
|
Cool. Thanks. Eliminating one level of quotes means a lot!
|
Back to Top |
|
|