Javascript

Snitz™ Forums 2000
https://forum.snitz.com/forumTopic/Posts/68225?pagenum=1
05 November 2025, 02:34

Topic


MaD2ko0l
Javascript
12 February 2009, 16:08


hiya,

i have a small problem, not perticuarlly forum related but maybe somone knows how to help me out.
basically i need to combine 2 bits of javascript but i dont know enough javascript to do it.
Code:
<script  language="JavaScript">
<!-- Hide from older browsers... //Function to check form is filled in correctly before submitting
function CheckForm () {

var errorMsg = "";

//Check for a Name
if (document.MyForm.Name.value==""){
errorMsg += "\n\tName \t\t- Please Enter Your Name!";
}

//Check for Comments
if (document.MyForm.Comments.value==""){
errorMsg += "\n\tCommentss \t- Please Enter Description Of The File Being Uploaded!";
}

//Check for File to be uplaoded
if (document.MyForm.FILE1.value==""){
errorMsg += "\n\tFile \t- Please Select A File To Be Uploaded!";
}

//If there is a problem with the form then display an error
if (errorMsg != ""){
msg = "____________________________________________________________________\n\n";
msg += "Your File has not been submitted because there are problem(s) with the form.\n";
msg += "Please correct the problem(s) and re-submit the form.\n";
msg += "____________________________________________________________________\n\n";
msg += "The following field(s) need to be corrected: -\n";

errorMsg += alert(msg + errorMsg + "\n\n");
return false;



}

return true;
}
// -->
</script>

this bit of javascript is called with the onSubmit function, and if there isnt any errors with the form, it then needs to run this bit of code.
Code:
<SCRIPT LANGUAGE="JavaScript">
function ShowProgress()
{
strAppVersion = navigator.appVersion;
if (document.MyForm.FILE1.value != "" || document.MyForm.FILE2.value != "" || document.MyForm.FILE3.value != "")
{
if (strAppVersion.indexOf('MSIE') != -1 && strAppVersion.substr(strAppVersion.indexOf('MSIE')+5,1) > 4)
{
winstyle = "dialogWidth=385px; dialogHeight:140px; center:yes";
window.showModelessDialog('<% = barref %>&b=IE',null,winstyle);
}
else
{
window.open('<% = barref %>&b=NN','','width=375,height=115', true);
}
}
return true;
}
</SCRIPT>


can somone point me in the right direction on how i go about doing the 2?
thansk very much

MaD2ko0l<

 

Replies ...


MaD2ko0l
12 February 2009, 20:17


no worries.. think i got it sorted now.
thanks anyway<
© 2000-2021 Snitz™ Communications