Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IE Value set to Null shows "Null"

Status
Not open for further replies.

Argonto

Technical User
Mar 17, 2011
23
US
Hi i am working on a form and hit a snag. I need to set a value to null, however in IE whenever i set the value to null, the field that should be blank has the word Null in it.
Is there a way to set a value to null that is compatible with IE, Firefox, and Chrome?

Code:
this.form.unmform_Tix_Requested_Broadway_GoldCircle.value = null;
 
does html understand the value 'null'? i don't think so but have not researched it fully.

my advice is to change the code that checks the value, rather than the code that sets the value.
 
So the function works fine in chrome and Firefox, but IE renders it as text.

Here is the a larger example of what i am doing. When a customer selects a different series, i need the values to clear out.
Code:
<SCRIPT language=javascript type=text/javascript>

function set_pricetag(rad_obj)
{
var GoldCircle=document.getElementById('value1');
var PriceA=document.getElementById('value2');
var PriceB=document.getElementById('value3');
var PriceC=document.getElementById('value4');
var date=document.getElementById('value5');

var unmform_values=rad_obj.value.split(',');

GoldCircle.value=unmform_values[0];
PriceA.value=unmform_values[1];
PriceB.value=unmform_values[2];
PriceC.value=unmform_values[3];
date.value=unmform_values[4];
}
  </SCRIPT>
  
  
<SELECT onclick="set_pricetag(this); this.form.unmform_Tix_Requested_Broadway_GoldCircle.value=  null; calculate(this.form); this.form.unmform_Total_Broadway_PriceC.value=  null; this.form.unmform_Total_Broadway_PriceB.value=  null; this.form.unmform_Total_Broadway_PriceA.value=  null; this.form.unmform_Total_Broadway_GoldCircle.value=  null; this.form.unmform_Tix_Requested_Broadway_PriceC.value=  null; this.form.unmform_Tix_Requested_Broadway_PriceB.value=  null; this.form.unmform_Tix_Requested_Broadway_PriceA.value=  null;" name=unmform_Series > 

<OPTION selected value=0.00,0.00,0.00,0.00,No_Broadway_Selected name="No Selection">No Selection</option>
<OPTION value=160.00,111.00,93.50,72.25,---Series_1_Thurs@730--- name="unmform_Series1_Thurs730">Series 1: Thursday @ 7:30PM</OPTION>
<OPTION value=160.00,111.00,93.50,72.25,---Series_2_Fri@8--- name="unmform_Series2_Fri8">Series 2: Friday @ 8PM</OPTION>
<OPTION value=160.00,111.00,93.50,72.25,---Series_3_Sat@2--- name="unmform_Series3_Sat2">Series 3: Saturday @ 2PM</OPTION>
<OPTION value=Sold_Out!,111.00,93.50,72.25,---Series_4_Sat@8--- name="unmform_Series4_Sat8">Series 4: Saturday @ 8PM</OPTION>
<OPTION value=160.00,111.00,93.50,72.25,---Series_5_Sun@1--- name="unmform_Series5_Sun2">Series 5: Sunday @ 1PM</OPTION>
<OPTION value=160.00,111.00,93.50,72.25,---Series_6_Sun@6:00--- name="unmform_Series6_Sun730">Series 6: Sunday @ 6:30PM</OPTION></SELECT> </FONT></TD><FONT style="FONT-SIZE: 16px" color=#005999></TD></FONT></TR></TBODY></TABLE>


<BR>
<TABLE class=SMALL cellSpacing=0 cellPadding=0 width=700 frame=box align=center>
<TBODY><!--\\------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
\\ Broadway
  -->
<TR>
<TD vAlign=center width=270 align=left>
<DIV align=center></DIV></TD>
<TD vAlign=top width=180 align=middle>
<DIV align=center></DIV></TD>
<TD vAlign=top width=100 align=middle>
<DIV align=center><FONT size=3></FONT></DIV></TD>
<TD vAlign=top width=200 align=middle>&nbsp;</TD></TR>
<TR>
<TD style="BACKGROUND-COLOR: #005999" class=style2 vAlign=center width=270 align=left>
<DIV align=center><SPAN style="BACKGROUND-COLOR: #005999"><STRONG><FONT color=#ffffff size=3>Broadway</FONT></STRONG> <INPUT id=value5 type=hidden name=Series_Date> </SPAN></DIV></TD>
<TD bgColor=#d9d6d6 vAlign=center width=180 align=middle>
<DIV align=center><FONT color=#005999 size=3><STRONG>Number of&nbsp;Tickets</STRONG></FONT></DIV></TD>
<TD bgColor=#d9d6d6 vAlign=center width=100 align=middle>
<DIV align=center><FONT color=#005999 size=3><STRONG>Ticket Price</STRONG></FONT></DIV></TD>
<TD bgColor=#d9d6d6 vAlign=center width=200 align=middle>
<DIV align=center><FONT color=#005999 size=3><STRONG>Total</STRONG></FONT></DIV></TD></TR>
<TR vAlign=center>
<TD style="WIDTH: 55px" width=270 align=middle>
<TABLE border=0 cellSpacing=0 cellPadding=0 align=left>
<TBODY>
<TR>
<TD><STRONG><INPUT border=0 value="Gold Circle" readOnly align=middle size=10 name=Broadway_GoldCircle> </STRONG></TD>
<TD><INPUT value=Orchestra type=radio name=unmform_Broadway_GoldCircle_Location> Orchestra<BR><INPUT value=Mezzanine type=radio name=unmform_Broadway_GoldCircle_Location> Mezzanine </STRONG></TD></TR></TBODY></TABLE></TD>
<TD style="WIDTH: 137px" vAlign=center width=180 align=middle>
<DIV align=center><STRONG><SPAN style="WIDTH: 95px"><INPUT onkeyup="this.form.unmform_Total_Broadway_GoldCircle.value = ((this.form.unmform_Tix_Requested_Broadway_GoldCircle.value * this.form.Series_GoldCircle.value) -0 ).toFixed(2);calculate(this.form)" name=unmform_Tix_Requested_Broadway_GoldCircle autocomplete="off"> </SPAN></STRONG></DIV></TD>
<TD style="WIDTH: 100px" vAlign=center width=100 align=middle>
<DIV align=center><SPAN style="WIDTH: 95px"><INPUT id=value1 readOnly size=10 name=Series_GoldCircle> </SPAN></DIV></TD>
<TD style="WIDTH: 100px" vAlign=center width=200 align=middle>
<DIV align=center><STRONG><SPAN style="WIDTH: 94px"><INPUT border=0 value=0 readOnly size=10 name=unmform_Total_Broadway_GoldCircle> </SPAN></STRONG></DIV></TD></TR>
<TR bgColor=#4c4c4c>
<TD height=2 vAlign=center align=middle></TD>
<TD style="WIDTH: 137px" vAlign=center align=middle></TD>
<TD style="WIDTH: 100px" vAlign=center align=middle></TD>
<TD style="WIDTH: 100px" vAlign=center align=middle></TD></TR>
<TR>
<TD style="WIDTH: 55px" vAlign=center width=270 align=middle>
<TABLE border=0 cellSpacing=0 cellPadding=0 align=left>
<TBODY>
<TR>
<TD><STRONG><INPUT border=0 value="Price A" readOnly align=middle size=10 name=Broadway_PriceA> </STRONG></TD>
<TD><INPUT value=Orchestra type=radio name=unmform_Broadway_PriceA_Location> Orchestra<BR><INPUT value=Mezzanine type=radio name=unmform_Broadway_PriceA_Location> Mezzanine </STRONG></TD></TR></TBODY></TABLE></TD>
<TD style="WIDTH: 137px" vAlign=center width=180 align=middle>
<DIV align=center><STRONG><SPAN style="WIDTH: 95px"><INPUT onkeyup="this.form.unmform_Total_Broadway_PriceA.value = ((this.form.unmform_Tix_Requested_Broadway_PriceA.value * this.form.Series_PriceA.value) -0).toFixed(2);calculate(this.form)" name=unmform_Tix_Requested_Broadway_PriceA autocomplete="off"> </SPAN></STRONG></DIV></TD>
<TD style="WIDTH: 100px" vAlign=center width=100 align=middle>
<DIV align=center><FONT size=3><STRONG><FONT color=#990c00><SPAN style="WIDTH: 95px"><INPUT id=value2 readOnly size=10 name=Series_PriceA> </SPAN></FONT></STRONG></FONT></DIV></TD>
<TD style="WIDTH: 100px" vAlign=center width=200 align=middle>
<DIV align=center><STRONG><SPAN style="WIDTH: 94px"><INPUT border=0 value=0 readOnly size=10 name=unmform_Total_Broadway_PriceA> </SPAN></STRONG></DIV></TD></TR>
<TR bgColor=#4c4c4c>
<TD height=2 vAlign=center align=middle></TD>
<TD style="WIDTH: 137px" vAlign=center align=middle></TD>
<TD style="WIDTH: 100px" vAlign=center align=middle></TD>
<TD style="WIDTH: 100px" vAlign=center align=middle></TD></TR>
<TR>
<TD style="WIDTH: 55px" vAlign=center width=270 align=middle>
<TABLE border=0 cellSpacing=0 cellPadding=0 align=left>
<TBODY>
<TR>
<TD><STRONG><INPUT border=0 value="Price B" readOnly align=middle size=10 name=Broadway_PriceB> </STRONG></TD>
<TD><INPUT value=Orchestra type=radio name=unmform_Broadway_PriceB_Location> Orchestra<BR><INPUT value=Balcony type=radio name=unmform_Broadway_PriceB_Location> Balcony </STRONG></TD></TR></TBODY></TABLE></TD>
<TD style="WIDTH: 137px" vAlign=center width=180 align=middle>
<DIV align=center><STRONG><SPAN style="WIDTH: 95px"><INPUT onkeyup="this.form.unmform_Total_Broadway_PriceB.value = ((this.form.unmform_Tix_Requested_Broadway_PriceB.value * this.form.Series_PriceB.value) -0).toFixed(2);calculate(this.form)" name=unmform_Tix_Requested_Broadway_PriceB autocomplete="off"> </SPAN></STRONG></DIV></TD>
<TD style="WIDTH: 100px" vAlign=center width=100 align=middle>
<DIV align=center><FONT size=3><STRONG><FONT color=#990c00><SPAN style="WIDTH: 95px"><INPUT id=value3 readOnly size=10 name=Series_PriceB> </SPAN></FONT></STRONG></FONT></DIV></TD>
<TD style="WIDTH: 100px" vAlign=center width=200 align=middle>
<DIV align=center><STRONG><SPAN style="WIDTH: 94px"><INPUT border=0 value=0 readOnly size=10 name=unmform_Total_Broadway_PriceB> </SPAN></STRONG></DIV></TD></TR>
<TR bgColor=#4c4c4c>
<TD height=2 vAlign=center align=middle></TD>
<TD style="WIDTH: 137px" vAlign=center align=middle></TD>
<TD style="WIDTH: 100px" vAlign=center align=middle></TD>
<TD style="WIDTH: 100px" vAlign=center align=middle></TD></TR>
<TR>
<TD style="WIDTH: 55px" vAlign=center width=270 align=middle>
<TABLE border=0 cellSpacing=0 cellPadding=0 align=left>
<TBODY>
<TR>
<TD><STRONG><INPUT border=0 value="Price C" readOnly align=middle size=10 name=Broadway_PriceC> </STRONG></TD>
<TD align=middle>- Balcony Only - </STRONG></TD></TR></TBODY></TABLE></TD>
<TD style="WIDTH: 137px" vAlign=center width=180 align=middle>
<DIV align=center><STRONG><SPAN style="WIDTH: 95px"><INPUT onkeyup="this.form.unmform_Total_Broadway_PriceC.value = ((this.form.unmform_Tix_Requested_Broadway_PriceC.value * this.form.Series_PriceC.value) -0).toFixed(2);calculate(this.form)" name=unmform_Tix_Requested_Broadway_PriceC autocomplete="off"> </SPAN></STRONG></DIV></TD>
<TD style="WIDTH: 100px" vAlign=center width=100 align=middle>
<DIV align=center><FONT size=3><STRONG><FONT color=#990c00><SPAN style="WIDTH: 95px"><INPUT id=value4 readOnly size=10 name=Series_PriceC> </SPAN></FONT></STRONG></FONT></DIV></TD>
<TD style="WIDTH: 100px" vAlign=center width=200 align=middle>
<DIV align=center><STRONG><SPAN style="WIDTH: 94px"><INPUT border=0 value=0 readOnly size=10 name=unmform_Total_Broadway_PriceC> </SPAN></STRONG><SPAN style="WIDTH: 94px"><INPUT type=hidden name=unmform_LineBreak_Broadway_PriceC> </SPAN></DIV></TD></TR>
<TR bgColor=#4c4c4c>
<TD height=2 vAlign=center align=middle></TD>
<TD style="WIDTH: 137px" vAlign=center align=middle></TD>
<TD style="WIDTH: 100px" vAlign=center align=middle></TD>
<TD style="WIDTH: 100px" vAlign=center align=middle></TD></TR></TBODY></TABLE>
 
If it works in some browsers its because the null state is being interpolated as an empty string. The empty string is the semantically correct HTML I believe (as attributes of tags are strings in the HTML spec).
So instead of null use
 
When i set {this.form.unmform_Tix_Requested_Broadway_GoldCircle.value= "";} the function no longer runs.
 
then you have a typo somewhere that is causing a syntax error. use firebug to debug
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top