I am writing my first DotNetNuke module. It's a basic module, no database access required; the module simply processes a contact form and sends an email. The enter DotNetNuke application is on a test site located at dnn.govoter.org, and the contact form in C# working form is located on the main site at http://www.govoter.org/ContactUs.aspx. The latter works fine, but in migrating the form to a DotNetNuke module (just to learn module development mainly), aside from using VB.NET, I am running into very peculiar behavior. You can find the module installed here: http://dnn.govoter.org/AboutUs/ContactUs/tabid/64/Default.aspx
After following the basic steps to setup a module and removing the database connectivity (since all this module does is collect form data and send an email), I have a semi-working system. I can post the code (ViewContactUs.ascx and ViewContactUs.ascx.vb) if that would be helpful.
The form does work correctly when the appropriate data is filled in, and an email is sent using the DotNetNuke SendMail function. However, somethings do not behave correctly:
- When an email is successfully sent and I go back to the page, I do not get a fresh form, it says that the email was sent; it is not sending duplicates, it's just not displaying the form. This logic is handled by making the successful confirmation visible when the email was sent and hiding the form, but in the Page load function, the visibility is reversed
- When the email is not successful (say they enter a bad email address), there is a Throw error clause with an exception message equal to whatever is returned via the SendMail function. However, this message is never displayed, the form is just refreshed, even though there is a Catch clause with DotNetNuke's builtin ProcessModuleLoadException function.
- When I update this page, the updates are not visible on the web right away. Something like just adding a line of text to the module, and saving the file; I rebuild the site and refresh the browser, but nothing. 5 minutes later, it will show up. This really makes debugging problems time consuming--what causes it and how can I get around this?
- It almost seems like the data that is entered into the forms is stored in a session somehow--is this correct? It's not just apart of the normal postback, but I can enter data, go to a different website or webpage, return to the test site and open the contact form and see the data. Sometimes I have to click send, but the data will re-appear. LIke if I enter an incorrect email address and click send, then navigate away and find my way back again, when I click send with a correct email, it is replaced with the original incorrect. I'm not quite understanding how DotNetNuke achieves this, or what the purpose is of storing all form data somewhere and not overwriting it when the form data changes.
I have a .NET and programming background, but this is my first attempt at doing a basic DotNetNuke module, so any advice you can offer is greatly appreciated.