I have a custom block with a custom form that is supposed to be shown in two view pages (one of them is also the front page). First I had visibility rules per page and later on with a custom callback function, but I had the same problem with both methods.

The form is shown correctly when the front page is loaded. Then I click a link that takes me to the other page the block should be shown in and again the form is visible. When I use the back-button, I'm taken back to the front page, but the form is gone. The block is there, because I added some additional markup, which can be seen. I also made a second form and placed it in a block like the first one and the behaviour is the same.

I have forced reload on both pages. Additionally, if I click a node-link from the front page and then use the back button to return to the front page from the node, the forms are there.

I enabled hook_drupalgap_back, which is triggered and I use drupalgap_goto to move to the front, but it doesn't have any effect.

Comments

FTale created an issue. See original summary.

tyler.frankenstein’s picture

Category: Bug report » Support request
Status: Active » Postponed (maintainer needs more info)

Since DrupalGap 7 (via jQuery Mobile) is a multi-page application, it sounds like you are experiencing colliding DOM IDs when re-using the form. In your DrupalGap form builder function in JavaScript, try setting a unique id on the form based on some type of context):

function my_module_custom_form(form, form_state) {

  if (arg(1) == 123) {
    form.id += '_page_a';
  }
  else if (arg(1) == 456) {
    form.id += '_page_b';
  }
  

}

When a form is re-used and its id isn't unique, DrupalGap will strip out the form on the first page, to get ready to place it on the second page.

Does this technique solve the problem?

AV-4’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)

It did indeed, thank you very much!