Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hello,

 

I'm looking for a message Box which I could use in both Internet Explorer and Mozilla to help me display error messages of Validator controls in both types of browser.

 

In fact the ShowMessageBox property of the ValidationSummary control works fine with I.E but not with Mozilla Browsers...

 

If someone has an idea.

 

NB : If necessary, VB samples are welcome.

Scalf.

Do not want others to know what you have done? Better not have done it anyways.

Posted
Hello,

 

I'm looking for a message Box which I could use in both Internet Explorer and Mozilla to help me display error messages of Validator controls in both types of browser.

 

In fact the ShowMessageBox property of the ValidationSummary control works fine with I.E but not with Mozilla Browsers...

 

If someone has an idea.

 

NB : If necessary, VB samples are welcome.

 

You might be better off disabling the ShowMessageBox property, writing a javascript function that mirrors your server validation code, and then adding it to the button onClick using:

button1.Attributes.Add("onClick", "return yourjavascriptfunction();")

 

Then return false or true from the javascript function to either cancel the button click, or submit the form as appropriate. If you add a javascript alert into your validation code if validation fails, this will run in all browsers that support javascript.

 

Hope this helps,

 

Adam

Posted

Thank you very much,

 

I thought of that at the beginning but what I find boring with Javascript is the many syntaxes for the different objects of the form...For exemple, I'm trying for the moment to read the value of two radio buttons to see if they are checked or not. I succeeded for the first radio button, but with the same syntax, on the second radio button, it doesn't work...

 

this is the syntax I use :

 

if(document.forms[0].myRadioBtn1[0].checked ==false)

 

{

 

some code..

 

}

 

If it works for one, it should work for the other button, but unfortunatly...it doesn't work :(

 

You might be better off disabling the ShowMessageBox property, writing a javascript function that mirrors your server validation code, and then adding it to the button onClick using:

button1.Attributes.Add("onClick", "return yourjavascriptfunction();")

 

Then return false or true from the javascript function to either cancel the button click, or submit the form as appropriate. If you add a javascript alert into your validation code if validation fails, this will run in all browsers that support javascript.

 

Hope this helps,

 

Adam

Scalf.

Do not want others to know what you have done? Better not have done it anyways.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...