PDA

View Full Version : call second function after first



vineet
12-31-2008, 03:41 PM
hi all

i have two functions



function Checkfiles(f){
f = f.elements;
if(/.*\.(gif)|(jpeg)|(jpg)$/.test(f['banner_image'].value.toLowerCase()))
return true;
alert('Please Upload Gif or Jpg Images.');
f['banner_image'].focus();
return false;
};


function start()
{
document.getElementById('worli').style.visibility = 'visible';
}


calling these functions


<form action="" method="post" enctype="multipart/form-data" name="form_up" id="form_up" onsubmit="start(); return Checkfiles(this);">


what i need is, if "function checkfiles" returns no error or no alert then "function start" should work otherwise not.

vineet

Twey
12-31-2008, 03:46 PM
What you ask is easy:
<form action="" method="post"
enctype="multipart/form-data"
name="form_up"
id="form_up"
onsubmit="return Checkfiles(this) && start();">What you need, however, is not possible: in most modern browsers, the values of file inputs are inaccessible for security reasons.

vineet
12-31-2008, 03:59 PM
What you ask is easy:
<form action="" method="post"
enctype="multipart/form-data"
name="form_up"
id="form_up"
onsubmit="return Checkfiles(this) && start();">What you need, however, is not possible: in most modern browsers, the values of file inputs are inaccessible for security reasons.

hi Twey

thanks. It works for me in latest IE7 and FF3.

dont know about rest of old browsers.

VINEET