Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesServer side validation in Settings.ascxServer side validation in Settings.ascx
Previous
 
Next
New Post
7/5/2010 9:55 PM
 
Hello, I did several searches, yet still not found a solution to how do we do server side validation in Settings page.

Anyone could shed some light on how could I stop the page from redirecting to the Home page when I click Update.

When I encounter invalid settings (which must be checked from server side), I want to display some messages but the page keep redirecting.

For client side validation, I tried to do something like this

<script language="javascript" type="text/javascript">
function isValid()
{
// Some logic here and return true/false accordingly.
// The checking logic is slightly
}
</script>

On server side I tried to inject javascript to the CommandButton cmdUpdate like this

var cmdUpdate = this.Parent.TemplateControl.FindControl("cmdUpdate") as CommandButton;
if (cmdUpdate != null) cmdUpdate.Attributes.Add("onclick", " if (!isValid()) return false;");

but no luck.

When I view source code. the javascript "if" statement is injected in "onclick" event of the "<span>" element of the CommandButton. But the postback of the button is in the "onclick" event of the "<input>" element inside so it seems like the onclick of the <span> overrides the onclick of the <input>????.

For e.g <span onclick="...."><input onclick="...">.....</input></span> <-- this is how the CommandButton is generated on the client.

Thanks everyone for your time reading this and excuse my broken English.

:(

Regards

Alex To
 
New Post
7/6/2010 2:55 AM
 
Alex, for server side validation, you are using either validation controls in aspx (per control) or custom validation in update event. There are a number of samples in code of the core framework and core modules.

Cheers from Germany,
Sebastian Leupold

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
New Post
7/6/2010 6:49 AM
 
Thanks for your prompt reply.

I'm still looking for an example, I tried to put a custom validation and set value IsValid of a target control to False but still after the UpdateSettings() method, the page is redirected to Home.

Will try to search for a sample module and post again if I happen to solve this.

Thanks
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesServer side validation in Settings.ascxServer side validation in Settings.ascx


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out