Click here to Skip to main content
15,901,708 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
heyy..

I am using a javascript function ..in that I use a alert message..the alert mesage is working fine..

But My problem is when two or three time alert message is came ,a check with text is seen("Prevent this page from creating additional dialogs ") ..when clicked this check box ..and next time the alert message will not came..Hence my javascript validation will break....

plz help ....its urgent...here is my javavascript code....


XML
<script type="text/javascript">
    $(function() {
        $('#<%=flulayout.ClientID %>').change(function() {
            var fileExtension = ['jpeg', 'jpg', 'png', 'gif', 'bmp'];
            if ($.inArray($(this).val().split('.').pop().toLowerCase(), fileExtension) == -1) {
                alert("Only '.jpeg','.jpg', '.png', '.gif', '.bmp' formats are allowed.");
                document.getElementById('<%=flulayout.ClientID%>').value = "";
                flulayout.focus();

            }
        })
    })
</script>
Posted

1 solution

That your problem is urgent to you does not make it urgent for us. We all volunteer our time and expertise to help you. Saying your issue is urgent will not get a quicker response, it will only drive some members away from helping you.

One thing I would suggest is that you don't have the alert in an onchange event because it will potentially fire every single time a user makes any change to the value in that control. What might make better sense is to let the user complete their change first, then run your validation against it. To do this, you would use the blur event instead.

If you really want to perform validation on every change to the control, then just do the validation, but move the alert itself to the blur event so that the user isn't constantly being barraged by alerts.
 
Share this answer
 
Comments
aravindnass 10-Mar-13 3:08am    
ok..I accept that but ...Is there any solution for prevent the check box from the alert message...(that automatically occur)..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900