Hi
Since esi process rendering separately <input tag id is duplicating. Since id ='edit-submit' ajax.js is failed to add 'ajax-processed'
Ex:
<input type="submit" class="form-submit ajax-processed" value="Vote" name="op" id="edit-submit">

Steps to replicate:
Step1: Add two form(either custom or contribute(Advance polls)) but both should in ajax widget(submission through ajax).
Step 2: Add both form through view_block or panel-pane and mark it as esi.
Step 3: Set varnish and refresh the page
Step 4:Click the submit button of first ajax form and it will run perfectly
Step 5: Click second ajax form submit button. Expected output is form submit through ajax.js. But actual output is page-submit take place, because of not appending class called 'ajax-processed' in
<input type="submit" class="form-submit" value="Vote" name="op" id="edit-submit">

This is because esi rendering. Each time button html rendering like
<input type="submit" class="form-submit" value="Vote" name="op" id="edit-submit">

In my example both esi form input is like this only(<input type="submit" class="form-submit" value="Vote" name="op" id="edit-submit">)

But if we remove esi and run normally then

First form input html
<input type="submit" class="form-submit" value="Vote" name="op" id="edit-submit">

Second form input html
<input type="submit" class="form-submit" value="Vote" name="op" id="edit-submit--1">

Now id="edit-submit" and id="edit-submit--1" are differ and 'ajax-processed' added to each input tag.

Without esi:
First form input html
<input type="submit" class="form-submit ajax-processed" value="Vote" name="op" id="edit-submit">

Second form input html
<input type="submit" class="form-submit ajax-processed" value="Vote" name="op" id="edit-submit--1">

With esi:
First form input html
<input type="submit" class="form-submit ajax-processed" value="Vote" name="op" id="edit-submit">

Second form input html
<input type="submit" class="form-submit" value="Vote" name="op" id="edit-submit">

Comments

tssarun’s picture

Issue summary: View changes

.

tssarun’s picture

Issue summary: View changes

2

tssarun’s picture

Hi,

Any update on this?

manarth’s picture

Title: ajax-processed is not working esi » When multiple forms are served by ESI, duplicate submit IDs break Ajax form processing
Category: bug » support
Status: Active » Fixed

The issue you describe is because the forms depend on global state - i.e. the submit button is named with the knowledge of other forms on the page. Content served by ESI does not have knowledge of global state, because it's served in its own process. If a section does need global state information, this needs to be provided in the ESI handler - for example, we do this through the URL to pass theme information.

I can't think of a simple approach to fixing this at a global level, because ESI would end up having to track such a massive amount of state information that it would lose the performance benefits that makes it useful.

In this instance, I'd suggest implementing a form-alter, and hard-coding the ID of the submit handler on the second form.

tssarun’s picture

Hi Manarth,

Thankx for your reply. YES through hook-form-alter we can modify form-submit-id. What i done is, through form-alter i append node-id(nid) with $form['submit'].

My code like this:

$form['custom-submit-{nid}'] = $form['submit']; // {nid} where nid of advance poll
unset($form['submit']);
And its executes fine.

Regards
tssarun.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

3