Try our conversational search powered by Generative AI!

Page reloads after submit in edit mode

Vote:
 

Hello!

I have a page in Episerver CMS 8 that contains a simple search form (MVC). When in edit mode the page reloads after submitting the form which causes the search results to disappear. I have debugged it and first an action is called to perform the search which returns ans shows the results. Then inmediately the Index action is called and the page reloads.

Has anybody had a similar problem? Really tricky since the page works fine in view mode.

Thanks

/Kenia

#150413
Jun 17, 2016 11:24
Vote:
 

Hi,

Just a curious question, why do you submit the search form in Edit Mode? To get a good editor experience?

Generally I don't recommend to submit forms in edit mode. It's better to tweak your view to give a good editor experience in Edit Mode instead.

If you need some search results listed to get a good editor experience I would suggest that you populate your search results with some dummy data when inside the Edit Mode.
You can check this in your Controller or view by looking at EPiServer.Editor.PageEditing.PageIsInEditMode (http://world.episerver.com/documentation/class-library/?documentId=cms/9/91E69382)

#150437
Edited, Jun 17, 2016 13:38
Vote:
 

Hi, Kenia,

You can also use POST instead of GET in edit mode. When rendering the form:

@using (Html.BeginForm(null, null, Model.SearchPageRouteValues, PageEditing.PageIsInEditMode ? FormMethod.Post : FormMethod.Get, new RouteValueDictionary(new { @id = "search-form" })))
        {
                ...
        }

But, generally, yes, we also don't support submitting forms in edit mode, it sometimes takes time to support it, so it does not pay off to invest time into it.

BR,
Marija

#150441
Jun 17, 2016 14:31
Vote:
 

Hi there!

It's actually the client who reported this as a problem since she was clearly using the form both in edit and preview mode for searching.  I know though edit mode is a little special to work with so I was hoping somebody would have some workaround for it.

Marija, the request has been sent as a "Post" from the beginning in the case of this page.

We drop the issue for now. Thanks anyway!

/Kenia

#150448
Edited, Jun 17, 2016 17:19
Vote:
 

To be sneaky you could even disable the search form in edit mode ;)

#150450
Jun 17, 2016 17:53
Vote:
 

I normally don't support post in edit mode. "Won't fix." :)

#150452
Jun 18, 2016 10:42
Vote:
 

I'll make sure it's clear from the beginning in future projects, that form submitting is not supported in edit mode.

Thanks guys for your input!

/Kenia

#150847
Jun 29, 2016 14:24
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.