How to check whether the user has added an attachment while requesting from catalog

Community Alums
Not applicable

Hi All,

 

I have to validate whether user has added an attachment or not before allowing him to submit a request.Please help me if any of you have done a similar kind of implementation.

 

Regards,

Kirti

1 ACCEPTED SOLUTION

Harish Murikina
Tera Guru

Write the below on submit script



function onSubmit() {




  var attachmentList = gel("header_attachment_list_label");



  if (attachmentList)


  {


  if (attachmentList.style.visibility == "hidden" || attachmentList.style.display == "none")


  {


  alert("Please attach the required file.");


  return false;


  }


  }


}




Regards,


Harish.


View solution in original post

17 REPLIES 17

Community Alums
Not applicable

Yes i checked in demo.its working fine But Iam confused now..which approcah is better


that's upto you   there will be always number of solution for every problem.... pick one that suits you



gel solution is simple. Will work now .. but would it work in future ? am afraid nobody could answer that... might work or might not...


querying the attachment table > will work now and always ... But you need to script a bit



so you need to decide which path to take


Community Alums
Not applicable

Thank you. I will keep this in mind ..For now Iam not using that validation as i felt i can validate whether he is attaching a doc but i wont be able to validate if he is attaching a meaningful required file..:)