Main Site Documentation

How using an option value from a browser in spider code?


#1

Im using FEZ Spider and Ethernet_J11D module under SDK V4.2. I would like to get in a variable the value set into browser.

The html page is coded as below:


void AlarmePage_WebEventReceived(string path, WebServer.HttpMethod method, Responder responder)
 {
string s = "<html>\n";  // page type
s += "<HEAD><TITLE>Alarme Maison</TITLE>";              // the page header
s += "<body>\n";                                           // start the body     
s += "<select name=\"selectionFieldPP\"><option value=\"PPActiver\">Activer </option><option value=\"PPDesactiver\">Desactiver </option><class=\"textBox80\"/></select>";
s += "</body>";                                     // close the body section
s += "</html>";                                     // close the page type
}

The aim is to make the link between the value selected in browser and .NET Gadgeteer code:


If (selectionFieldPP == PPActiver)
{
	....
}
Else
{
.....
}

AlarmePage_WebEventReceived() is called as bellow:


void ethernet_NetworkUp(GTM.Module.NetworkModule sender, GTM.Module.NetworkModule.NetworkState state)
        {

            string ipAddress = ethernet.NetworkSettings.IPAddress;
            WebServer.StartLocalServer(ipAddress, 80);
            
            AlarmePage = WebServer.SetupWebEvent("Connexion");

            Identification.WebEventReceived += new WebEvent.ReceivedWebEventHandler(AlarmePage_WebEventReceived);
}

Is there some one who can help me ?


#2

Done :slight_smile:


#3

Thank you andre.m
It works for me :slight_smile:

Now I’m trying to modify some parameters in browser using message received from Xbee.
If you have an idea please see question “Message from Xbee could not received by FEZ spider when using also HttpListener”