µTasker Forum > µTasker general
HTML parameters update, however browser controls don't indicate
(1/1)
Ray:
Hi Mark,
I'm sure this is me not understanding HTML, about all I know I've learned doing this project, and html5-editor.net for building tables.
From 3admin.htm I'm using your SNTP TimeZone drop down box and enable checkbox, and IP address box, but that works They properly save the parameters, however, they don't ever refresh the browser controls so after a save, they don't properly show the selections. The IP address populates correctly:
HTML:
<form action=sntpcfg.htm name=r>
<table border="0"><tr><th>
<table border="1">
<p style=""font-size: 1.5em;""><strong>SNTP Server configuration</strong></p>
<tr><th>
Time Zone<select name=C>
<option value="a"$sCa0>UTC-12:00
<option value="b"$sCb0>UTC-11:00
<option value="c"$sCc0>UTC-10:00 HAST
<option value="d"$sCd0>UTC-9:00 AKST
<option value="e"$sCe0>UTC-8:00 PST
<option value="f"$sCf0>UTC-7:00 MST
<option value="g"$sCg0>UTC-6:00 CST
<option value="h"$sCh0>UTC-5:00 EST
<option value="i"$sCi0>UTC-4:30
<option value="j"$sCj0>UTC-4:00 AST
<option value="k"$sCk0>UTC-3:30 NST
<option value="l"$sCl0>UTC-3:00
<option value="m"$sCm0>UTC-2:00
<option value="n"$sCn0>UTC-1:00
<option value="o"$sCo0>UTC
<option value="p"$sCp0>UTC+1:00
<option value="q"$sCq0>UTC+2:00
<option value="r"$sCr0>UTC+3:00
<option value="s"$sCs0>UTC+3:30
<option value="t"$sCt0>UTC+4:00
<option value="u"$sCu0>UTC+4:30
<option value="v"$sCv0>UTC+5:00
<option value="w"$sCw0>UTC+5:30
<option value="x"$sCx0>UTC+5:45
<option value="y"$sCy0>UTC+6:00
<option value="z"$sCz0>UTC+6:30
<option value="A"$sCA0>UTC+7:00
<option value="B"$sCB0>UTC+8:00
<option value="C"$sCC0>UTC+9:00
<option value="D"$sCD0>UTC+9:30
<option value="E"$sCE0>UTC+10:00
<option value="F"$sCF0>UTC+11:00
<option value="G"$sCG0>UTC+12:00
<option value="H"$sCH0>UTC+13:00
</select><br>
<tr><th>Enable Daylight Saving <input type=checkbox name=D $sCS><br>
SNTP Server IP<input maxLength=15 size=15 name=IT0 value="$vIT"><br>
<input type=submit value="Save" name=r></form>
The URL is http://172.22.50.34/sntpcfg.htm?C=g&D=on&IT0=172.22.1.59&r=Save
Looking at this, every indication it should open option "g" and provide the enable checkbox, but it doesn't. It correctly saves the parameters and shows the IP address.
I can live with this on a configuration screen, it's just curious that I thought it would update the chosen parameter
mark:
Hi Ray
Check the user function:
static unsigned char fnIsSelected(unsigned char *ptrBuffer)
This should handle the decision as to whether the particular entry is selected or not but I don't think it is handling the 'C' case.
Try adding something like
case 'C':
if (*ptrBuffer == 'S') { // daylight saving case
if (the box should be checked) {
return IS_CHECKED;
}
}
else if (*ptrBuffer matches the one that is presently selected) { // time zone case assumed
return IS_SELECTED; // select the entry
}
break;
Regards
Mark
Ray:
Hi Mark,
Yes, I definitely have a general lack of HTML skills, but luckily the online live html editors work really well.
1) I was not properly using IS_CHECKED, IS_SELECTED, NOT_SELECTED, nor IS_DISABLED correctly, I think I've got that working.
2) I needed to separate the selection variables on the two controls fnIsSelected *ptrBuffer. using case "$sCS": for the DST checkbox, and repurposed "$sB_" for the list box
3) commented out all unused options to prevent unintended consequences
I believe it is working correctly, I'll test more over the next few days
I didn't see how to "store" the result of the variable sent to fnHandleWeb() for the drop down box here:
/sntpcfg.htm?C=g&D=CS&IT0=172.22.1.59&r=Save
I took 'g' and stored it in a local unsigned char variable to use in the fnIsSelected()
unsigned char ListChoice = 0;
static unsigned char fnIsSelected(unsigned char *ptrBuffer)
{
// Format $sAB (length assumed to be 4 bytes, even when both parameters are not used)
//
unsigned char ucCheck = NOT_SELECTED;
switch (*ptrBuffer++) {
case 'C': // Custom codes
switch (*ptrBuffer) {
case 'S': // DST checkbox
if((temp_pars->temp_parameters.ucTimeZoneFlags&0x80)>0) return IS_CHECKED;
else return NOT_SELECTED;
default:
return IS_DISABLED;
}
case 'B': // Custom codes for time zone choice
if(ListChoice == *ptrBuffer) return IS_SELECTED;
else return NOT_SELECTED;
..
..
..
static int fnHandleWeb(unsigned char ucType, CHAR *ptrData, HTTP *http_session)
{
static unsigned char NewTimezoneData = 0;
unsigned char *ucPtr;
switch (ucType) {
case 'C': /// RJS Variable found "C="_
switch (*++ptrData) { // preincrement past '=' need to switch a..z..A..H to capture all 34
case 'a':
ListChoice = *ptrData;
NewTimezoneData = 0; // set the timezone to 'a'
break;
Thank You! Everything seems to be running smoothly now.
Navigation
[0] Message Index
Go to full version