Blocks not re-ordering

  • Good morning,


    I can't seem to get blocks to honour my re-ordering at all - everything seems to be defaulting to the order the items were added. I've tried striping the code back to the blocks code found in the documentation to see if it is anything in my regions but that hasn't helped. I've also tried removing the region entirely, renaming it etc but nothing seems to work.


    You can see a short video of what's going on here.


    My blocks code looks like this:

    My region code looks like:

    Code
    1. perch_content_create('Blocks', array(
    2. 'template' => 'services/blocks.html'
    3. ));
    4. perch_content_custom('Blocks');

    And my diagnostic is:

    Any help would be appreciated.


    Thanks, Lea.

  • Hi tidygraphic,


    Do you get any errors in your browser console?



    All your ids are the same in each block


    I don't think this would be a problem. Each block is like a mini-template by itself (much like repeater items). As long as the type attribute on the perch:block tags are unique, I don't think this would be an issue. I heavily re-use the same IDs inside different perch:block tags for consistency (and my sanity).

  • Thanks for the responses guys (I did think ID's but no, that's not it).


    No errors in Perch debug and nothing in the console when I move and save the blocks. No doubt this is going to be something stupid as if it was a bug others would have reported it by now. Not sure where to look next though!

  • OK I've done more testing and with a totally new region I'm now seeing this behaviour where the region now re-orders itself (without me touching it) on every save. That's using this code in a totally new region:

    I'd really love to know what's going on - it's the last page template in the project!


    Thanks, Lea.

  • Initially there weren't (in the first example). I've since tried with another block area with a field outside - this is where the even stranger behaviour occurred (see second video). That's where I can re-order the blocks but they also seem to re-order themselves on every save.

  • So I've just put up a new test region and on this one I can re-order them but when I add a new block, or when I save the region they return to a random order. You can see this happening here. Code for this test region is like so:

    I don't know if it's significant but in the debug when I first visit the region in Perch it mentions "Form not posted or did not validate" underneath the "Using template: /templates/content/services/test-block.html" line. When I hit save I get the usual debug stuff and a "Setting alert: Content successfully updated (success)" message.


    Could it be something in the database ?

  • I don't know if it's significant but in the debug when I first visit the region in Perch it mentions "Form not posted or did not validate" underneath the "Using template: /templates/content/services/test-block.html" line. When I hit save I get the usual debug stuff and a "Setting alert: Content successfully updated (success)" message.

    That sounds entirely correct. When you first visit the page, the form hasn't been posted.


    Is this your dev environment?