µTasker Forum
µTasker Forum => NXPTM M522XX, KINETIS and i.MX RT => Topic started by: evgenik on September 10, 2008, 12:53:11 PM
-
Hi Mark.
Now I work with Web Interface. This is small part of HTML code of file "0.htm":
<form action=1.htm name=r>
<table border = "2" align=center cellspacing=5 bordercolor=gray width = 240>
<TR><th colspan=2 bgcolor = #AABBFF>
<TR>
<TD align = left> Login as : </TD>
<TD align = center ><SELECT NAME=T id="loginas">
<OPTION VALUE="0"><b>-- User type --</b>
<OPTION VALUE="1">Regular User
<OPTION VALUE="2">Administrator
</SELECT></TD></TR>
<TR><TD align = left>Password: </TD>
<TD align = center><input name=C size =12 maxlength =6></TD></TR>
</TR></table><br>
<table border = "2" align=center cellspacing=5 bordercolor=gray>
<tr><td><input type=submit value="E n t e r" name=r></td></tr>
</table></form>
When I press button on the form in "0.htm" file, application receive and check all my data but I don't know how generate (open) "1.htm" file if application check is successfully.
In HTML code I write:
<form action=1.htm name=r> ...
<input name=C size =12 maxlength =6>
<input type=submit value="E n t e r" name=r></form>
but before this action I need do application check and if check is successfully then open "1.htm".
Thanks.
Evgeni.
-
Hi Evgeni
To respond with a different page to the default one, you can do something like the following:
static int fnHandleWeb(unsigned char ucType, CHAR *ptrData, HTTP *http_session)
{
...
switch (ucType) {
case 'x':
if (fApplicationCheck() == 0) {
return '1'; // cause web page '1' to be returned
}
else {
return 0; // serve standard web page
}
}
...
}
Another method is to embed the code that you want to return:
static const CHAR my_action[] = "<form action=1.htm name=r> ...<input name=C size =12 maxlength =6><input type=submit value=""E n t e r"" name=r></form>";
and then you can return this (rather than a file from the file system) using the following technique:
http_session->ptrFileStart = (unsigned char*)my_action;
http_session->FileLength = sizeof(my_action)-1;
return DISPLAY_INTERNAL;
Regards
Mark
-
Thank for quik response.
After small correction this begun work but in this state I have additional question: How to disable (do not reflect) in Internet Explorer address line record that received by application (in red color):
"http://XXX.XXX.XXX.XXX/name=r?T=3&C=1&r=E+n+t+e+r"
Thanks.
-
Hi Evgeni
The parameters are displayed when using the GET method as you presently are.
If you use the POST method the parameters will not be displayed in the URL address line.
See the following thread for details:
http://www.utasker.com/forum/index.php?topic=100.0
We now have a version which seems to be working well to handle this but it hasn't been released in all SPs.
Please contact me directly for a copy if you would like to try it immediately.
Today there was a new SP for the Luminary parts and a M5223X SP is the next on the list - including SUB support for the M5221X/M5222X devices. I will be checking new USB boot loader support later and, if all goes well, it may be available before the end of the week (including the new parameter POST stuff).
Regards
Mark
PS. What did you correct? I can then correct the previous post.