Try our conversational search powered by Generative AI!

Episerver Forms without javascript

Vote:
 

Hi,

I am working on implementing episerver forms on a website and when i try to use a form with javascript diabled the behaviour is not what i am expecting. when you submit the form it returns an empty page.

can anyone confirm if forms is supposed to work without javascript? if not is there a specific reason the validation etc cannot be done server-side?

i noticed a setting in the forms.config file called 'workInNonJSMode' but setting it to true doesn't seem to have done anything.

thank you

#172241
Nov 28, 2016 15:32
Vote:
 

Hi, Sam,

I know that Episerver introduced support for forms working without js. I am not sure if you'd need to restart the site to have that working though, have you tried?

There is also a list of limitations, so might be that you find your answer here.

BR,

Marija

#172257
Nov 28, 2016 17:25
Vote:
 

Hi Marija,

Yes, it appears that i have to restart the site in order for the workInNonJSMode="true" setting to take effect. However, when the setting is true the affect is that the javascript which is normally needed to make the forms work is not loaded onto the page. This means that the forms behave as if you have javascript turned off (clicking submit triggers a post back but the response to the client is a blank page) which is not what i was expecting.

do you have any documentation that might help me to set the forms up to work without javascript?

the client the site is for require their forms to work without javascript and are currently using xForms which works okay without javascript so this will be a big issue for them.

i have seen that blog post already and unfortunately it doesn't cover the issue i am experiencing. The limitations listed by lockevn are acceptable to the client as long as the forms work in a basic way.

Sam

#172259
Nov 28, 2016 17:51
Vote:
 

I have fixed this issue now.

 

As i stated in my previous post the forms.config setting 'workInNonJSMode' tells episerver to not render the javascript to the page along with the form making the forms work without javascript for all users.

 

There is a slight difference between the js and non-js functionality that was causing the behaviour i described. basically, when its using js/ajax to post form data the post goes straight to the core controller identified in the forms.config but in non-js mode the post will first go to whatever controller is chosen by the template resolver. in my case the controller in question had one action on it that was set to only accept GET requests so episerver wasn't able to post to it. You don't have to manually validate or save any of the form data, as long as your controller action accepts posts then you should see the standard behaviour.

 

Sam

#172289
Edited, Nov 29, 2016 12:02
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.