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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Works in IE but not FireFox or NS

Status
Not open for further replies.

tpman

Programmer
Oct 15, 2004
25
US
I am developing an application that will be used in both Windows 2000 and Mac os 10. Windows/IE works fine but when I get to the Mac, I get an error in the data field stating that it is undefined. This is the code that I am using:
var ataReturn = "";

ataReturn = document.emtyFormBean.ataReturn.options.value

if(ataReturn == "")
{
alert("Please Select a ATA Chapter/Section")
}else{
opener.document.aosMaskFormBean.ata.value = ataReturn;
opener.document.aosMaskFormBean.ata_desc.value = "Updated on save";

self.close();
}
Any help as to why Netscape and Firefox both give me an undefined error message?
 
try this:

Code:
var theSel = document.forms['emptyFormBean'].elements['ataReturn'];
var theVal = theSel.options[theSel.selectedIndex].value;

if ( theVal == "" ) {
   ...
} else {
   ...
}

*cLFlaVA
----------------------------
[tt]tastes great, less filling.[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
Not getting past those definitions in the code. I put an alert just after the definitions to see where I am at but never reach them. I am getting into my function, it just doesn't like the first variable declaration. Suggestions?
 
Here is a majority of the code, with your suggested changes:
<SCRIPT language="JavaScript">
function passBackAta(row){
alert(row);
}
function takeAction()
{

var theSel = document.forms['emptyFormBean'].elements['ataReturn'];
alert("Got Here 1 " );
var theVal = theSel.options[theSel.selectedIndex].value;
alert("Got Here 2 " );

if (theVal == ""){
alert("Please Select a ATA Chapter/Section")
}else{
opener.document.aosMaskFormBean.ata.value = ataReturn;
opener.document.aosMaskFormBean.ata_desc.value = "Updated on save";

self.close();
}
}

</SCRIPT>
</HEAD>
<BODY>
<H1>ATA Code selection</H1>
<br>Please select an ATA Chapter/Section and click 'OK'</br>
<TABLE border="1" width="800" align="center">
<TBODY>
<logic:notPresent name='ataCodesDescListFormBean'>
<p>Nothing here</p>
</logic:notPresent>
<html:form action='mainFrame.do'>
<html:select name='ataCodesDescListFormBean' property='ataReturn' size='20'>
<html:eek:ptions collection='ataChapSectList' property='value' labelProperty='value_display'/>
</html:select>

<html:button property='Button' value='Submit' onclick="takeAction()" />
</html:form>
</TBODY>
</TABLE>
</BODY>
</HTML>
 
instead of having your function call in the submit button's onclick event, have it in your form's onsubmit event, like this:

[tt]onsubmit="return takeAction();"[/tt]

*cLFlaVA
----------------------------
[tt]tastes great, less filling.[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
On my onSubmit, I am getting the following error: JSP Translate: Attribute onSubmit invalid according to the specified TLD. Just what exactly does that mean?
 
My onsubmit is not executing the javascript. I have the alerts in the code but they never get hit and it hops right to the mainFrame.do. I am calling this page from another and trying to pass back a selected value back to the calling page. It totally bypasses the calling page. I'm not the greatest when it comes to Javascript.
 
Another thing, I am trying to pass a data value back to the calling page, but in reading about the onsubmit, it looks like it is looking for a boolean return value, not a value like "1234" for example. That's what I need to do.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top