0

I have a dropdown "product category" with Fill in option. But when I set validation on it as a mandatory field using javascript ie I check,

if (dropdown =="" || fillin=="")
    alert(required message)

but this doesn't works because even if focus from dropdown is taken away, its value is still stored in that dropdown so that creates a problem. can anyone suggest how do I resolve this focus issue?

enter image description here

0

Solution I tried :

function PreSaveAction(){
prodCategory = document.getElementById('#your_id_of_dropdownchoice').value;
prodCategoryFillIn = document.getElementById('#your_id_of_fill-in_textbox').value;
prodCategoryRadio = document.getElementById('#your_id_of_dropdown_radiobutton').checked;
prodCategoryFillInRadio = document.getElementById('#your_id_of_fill-in_radiobutton').checked;

if((prodCategoryRadio==true && prodCategory =="")||(prodCategoryFillInRadio ==true && prodCategoryFillIn ==""))
{alert("your message"); return false;}

else return true;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.