Forum


HomeHomePremiumPremiumDevelopmentDevelopmentStrange and unwanted DNN behavior on angular postsStrange and unwanted DNN behavior on angular posts
Previous
 
Next
New Post
5/6/2015 6:34 AM
 

Hi,

On the angular app that I am porting to a DNN module, there seems to be some strange DNN behavior. I think it is specific to DNN because the app works fine on a dedicated html-page.

The app is running under DNN-view mode and allows the end-user to do a calculation based on data that is retrieved from the server using an ajax-post. (the post i used because of the complex data-structure that is send to the server). Based on the data-retrieved, one of the available Angular partial views is loaded using the ng-include directive.

The strange (and unwanted) behavior that occurs:

  • DNN does a form-validation all by itself on the inputs that are on my view. This is not wanted, because I'm using an AJAX-post and not a regular submit.
  • Because my app (deliberately for the time being) does check the form validations, the AJAX-post still takes place and the app reacts as expected.
  • If DNN validates the form successfully, it refreshes the page (doing a non AJAX post?), which is not wanted at all.

Are there any specific settings that I'm missing here?

Regards,

Jacques


 

 
New Post
5/6/2015 8:37 AM
 

Jacques,

Make sure when you ported over the html code into your module view that you didn't include any <form> tags or <input type="submit"/> buttons.  If you do have a submit button, that could cause DNN to postback the page.  You could add event.preventDefault(); to the button click event or replace it with a different type of element.

 
New Post
6/3/2015 11:52 PM
 

Found it! Thanks.

I used the HTML5 button element without specifying type="button". Default interpretation of the button element is submit as it seems.

Did not realize that.
App is working fine now.

 
Previous
 
Next
HomeHomePremiumPremiumDevelopmentDevelopmentStrange and unwanted DNN behavior on angular postsStrange and unwanted DNN behavior on angular posts



Try FREE
30 days money back guaranteed