Developer forum

Forum » CMS - Standard features » Forms for editors - Multiple forms on same page

Forms for editors - Multiple forms on same page

Kim Søjborg Pedersen
Reply

Hi, I need some help. I have a page with multiple forms, but when I post a form it sends the wrong form. My form template looks like this, so what do I have the change to make it work?

<form method="post" class="form" action="@GetString("Form.Action")" enctype="multipart/form-data" id="@GetString("Form.HtmlId")" onsubmit="@GetString("Form.OnSubmit")">
        @GetString("Form.SystemFields")
        @{
            foreach (LoopItem field in GetLoop("Fields"))
            {
                    @((field.GetString("Field.Type") != "Hidden" && !field.GetBoolean("Field.IsButton")) ? field.GetString("Field.Name") : string.Empty);
                    @field.GetValue("Field.Control")
            }
        }
    </form>

 


Replies

 
Nicolai Pedersen
Reply

Hi Kim

If your onsubmit contains a script that have a url with &PID=XXX in it, it should work. PID contains the ID to the paragraph - and if that is submitted with your form, only the instance on that paragraph will be submitted.

I think I need a link to the page to see where the error is.

BR Nicolai

 
Kim Søjborg Pedersen
Reply

HI Nicolai,

I send you a url on e-mail.

 
Kim Søjborg Pedersen
Reply

The solution was to upgrade DW or adding this to the form:

<input type="hidden" name="PID" value="@Dynamicweb.Frontend.PageView.Current().CurrentParagraph.ID" />

 
René Poulsen
René Poulsen
Reply

Adding the PID field doesn't work for me.

@Kim what version did you need to upgade to, to get it working?

 
Kim Søjborg Pedersen
Reply
This post has been marked as an answer

With 8.8.1.13 we have multiple forms on one page

Votes for this answer: 1
 
René Poulsen
René Poulsen
Reply

Thank you Kim. I will get the solution upgraded.

 

You must be logged in to post in the forum