Page 1 of 1

Pink and my IPOD won't play nice

Posted: Tue Aug 02, 2011 1:59 pm
by Jay Bedard
Here is a sample of some code I am trying to use on a PINK module. When I access the site from IE8 it works fine. If I change a radio button it updates the PINK variable associated with that radio button and reloads the page. When I try this from either Safari on a pc or my IPOD it tries to do the update but I get a Safari can't coonnect to the web site error. If I refresh the page I get the original page.

Does anybody see anything in the code that might be giving either the PINK or Safari a problem?

<html>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<body>
<script type="text/javascript">
function FormSubmit()
{
document.getElementById("firstry").submit()
}

var status="<Nb_varSV>";
var ipaddr = "<Nb_varSI>";
var testit1 = "<Nb_var01>";
var testit2 = "<Nb_var02>";
var testit3 = "<Nb_var03>";
var TimeOfDay = "<Nb_var10>";
var testit11 = "<Nb_var11>";
var WeekDay = "<Nb_var12>";
var TheDate = "<Nb_var13>";
var theday=["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday","Friday","Saturday"];

if (testit1==10)
{
//document.write("The Red Led Should be on <br>");
RedOnString='<input name="Nb_var01" type="radio" value="10" checked onclick="FormSubmit()"></input>'
RedOffString='<input name="Nb_var01" type="radio" value="11" onclick="FormSubmit()"></input>'
RedLedBlink ='<input name="Nb_var01" type="radio" value="12" onclick="FormSubmit()" ></input>'
}
else if (testit1==11)
{
//document.write("The Red Led Should be Off");
RedOnString='<input name="Nb_var01" type="radio" value="10" onclick="FormSubmit()"></input>'
RedOffString='<input name="Nb_var01" type="radio" value="11" checked onclick="FormSubmit()"></input>'
RedLedBlink ='<input name="Nb_var01" type="radio" value="12" onclick="FormSubmit()" ></input>'
}
else if (testit1==12)
{
//document.write("The Red Led Should Blink");
RedOnString='<input name="Nb_var01" type="radio" value="10" onclick="FormSubmit()"></input>'
RedOffString='<input name="Nb_var01" type="radio" value="11" onclick="FormSubmit()"></input>'
RedLedBlink ='<input name="Nb_var01" type="radio" value="12" checked onclick="FormSubmit()"></input>'
}
else
{
//document.write("No Red Led Selection");
RedOnString='<input name="Nb_var01" type="radio" value="10" onclick="FormSubmit()"></input>'
RedOffString='<input name="Nb_var01" type="radio" value="11" onclick="FormSubmit()"></input>'
RedLedBlink ='<input name="Nb_var01" type="radio" value="12" onclick="FormSubmit()"></input>'
}
if (testit2==10)
{
//document.write("The Red Led Should be on");
GreenLedOnString='<input name="Nb_var02" type="radio" value="10" checked onclick="FormSubmit()"></input>'
GreenLedOffString='<input name="Nb_var02" type="radio" value="11" onclick="FormSubmit()"></input>'
GreenLedBlink = '<input name="Nb_var02" type="radio" value="12" onclick="FormSubmit()"></input>'
}
else if (testit2==11)
{
//document.write("The Red Led Should be Off");
GreenLedOnString='<input name="Nb_var02" type="radio" value="10" onclick="FormSubmit()"></input>'
GreenLedOffString='<input name="Nb_var02" type="radio" value="11" checked onclick="FormSubmit()"></input>'
GreenLedBlink = '<input name="Nb_var02" type="radio" value="12" onclick="FormSubmit()"></input>'
}
else if (testit2==12)
{
//document.write("There are no leds lit");
GreenLedOnString='<input name="Nb_var02" type="radio" value="10" onclick="FormSubmit()"></input>'
GreenLedOffString='<input name="Nb_var02" type="radio" value="11" onclick="FormSubmit()"></input>'
GreenLedBlink = '<input name="Nb_var02" type="radio" value="12" checked onclick="FormSubmit()"></input>'
}
else
{
//document.write("There are no leds lit");
GreenLedOnString='<input name="Nb_var02" type="radio" value="10" onclick="FormSubmit()"></input>'
GreenLedOffString='<input name="Nb_var02" type="radio" value="11" onclick="FormSubmit()"></input>'
GreenLedBlink = '<input name="Nb_var02" type="radio" value="12" onclick="FormSubmit()"></input>'
}
if (testit3==10)
{
//document.write("The Red Led Should be on");
YellowLedOnString='<input name="Nb_var03" type="radio" value="10" checked onclick="FormSubmit()"></input>'
YellowLedOffString='<input name="Nb_var03" type="radio" value="11" onclick="FormSubmit()"></input>'
YellowLedBlink = '<input name="Nb_var03" type="radio" value="12" onclick="FormSubmit()"></input>'
}
else if (testit3==11)
{
//document.write("The Red Led Should be Off");
YellowLedOnString='<input name="Nb_var03" type="radio" value="10" onclick="FormSubmit()"></input>'
YellowLedOffString='<input name="Nb_var03" type="radio" value="11" checked onclick="FormSubmit()"></input>'
YellowLedBlink = '<input name="Nb_var03" type="radio" value="12" onclick="FormSubmit()"></input>'
}
else if (testit3==12)
{
//document.write("There are no leds lit");
YellowLedOnString='<input name="Nb_var03" type="radio" value="10" onclick="FormSubmit()"></input>'
YellowLedOffString='<input name="Nb_var03" type="radio" value="11" onclick="FormSubmit()"></input>'
YellowLedBlink = '<input name="Nb_var03" type="radio" value="12" checked onclick="FormSubmit()"></input>'
}
else
{
//document.write("There are no leds lit");
YellowLedOnString='<input name="Nb_var03" type="radio" value="10" onclick="FormSubmit()"></input>'
YellowLedOffString='<input name="Nb_var03" type="radio" value="11" onclick="FormSubmit()"></input>'
YellowLedBlink = '<input name="Nb_var03" type="radio" value="12" onclick="FormSubmit()"></input>'
}

</script>

<form id="firstry" method="post" action="index.htm">
<table border="6" bgcolor=#D4D9DE cellpadding="10">
<tr>
<th colspan = "4" ><h2>Home Device Controller<br></h2>
<script>document.write("Time: " + TimeOfDay)</script><br>
<script>document.write("Date: " + theday[WeekDay]+" "+ TheDate)</script><br>
<script>document.write("Local IP addr: "+ipaddr)</script>
</tr>
<tr>
<th>Outputs
<td>On</td>
<td>Off</td>
<td>Schedule</td>
</tr>
<tr>
<th>Unit #1 - Green Led</th>
<td>
<script>document.write(GreenLedOnString)</script>
</td>
<td>
<script>document.write(GreenLedOffString)</script>
</td>
<td>
<script>document.write(GreenLedBlink)</script>
</td>
</tr>
<tr>
<th>Unit #2 - Family Room Light #1</th>
<td>
<script>document.write(RedOnString)</script>
</td>
<td>
<script>document.write(RedOffString)</script>
</td>
<td>
<script>document.write(RedLedBlink)</script>
</td>
</tr>
<tr>
<th>Unit #3 - Family Room Light #2</th>
<td>
<script>document.write(YellowLedOnString)</script>
</td>
<td>
<script>document.write(YellowLedOffString)</script>
</td>
<td>
<script>document.write(YellowLedBlink)</script>
</td>
</tr>
</table>
</form>
</body>
</html>

Re: Pink and my IPOD won't play nice

Posted: Wed Aug 03, 2011 4:00 pm
by tod
First welcome to the forum. Second, this sounds like a generic issue and not specific to the NB. Nothing wrong with asking here but compared to sites like stackoverflow bandwidth here is fairly low.

A couple of suggestions: First get more consistent with your use of “;” in JS, that way you can use JavaScript lint tools to scan your code for errors. Second, I don’t see anything wrong with the code but if you always submit the form with JS, it might help to disable the default form submission, that is add:

Code: Select all

<form onsubmit="return false;">