Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function checkArtistDetails(form){
- var valid = true; //boolean
- var fileName = form.filePictureFileName.value.toLowerCase(); //Sets chosen filename to LowerCase.
- //Checks if txtArtist is empty
- if(form.txtArtist.value == "")
- {
- window.alert( "Please enter the artists name.");
- form.txtArtist.focus();
- valid = false ;
- }
- //Checks if a file is choosen
- if(fileName == "")
- {
- window.alert("Please choose a picture.");
- form.filePictureFileName.focus();
- valid = false;
- }
- /*
- #############################
- HERE'S THE PROBLEM.
- #############################
- */
- //Checks if image-extension is correct
- if(fileName.lastIndexOf(".jpg") == -1 || fileName.lastIndexOf(".png") == -1)
- {
- window.alert("Only '.jpg' and '.png' file types are allowed.");
- valid = false;
- }
- else{
- return valid;}
- }
- //resets ArtistName-field
- function resetArtistName(form){
- form.txtArtist.value="";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement