Bloc ID

I have several blocs with the same ID.

I try to rename them in the order, but it tells me naturally that some IDs are already existing.
Is it an issue or I can let it like that?

Use Classes if you need to have the same name on each item. ID is supposed to be unique.

I don’t think it’s even possible ID in Blocs. Blocs will change the ID I’m pretty sure. It just adds a number at the end.

The reason is because ID is only meant to be used this way. It’s invalid HTML to have more than one and will trip and error in many modern consoles.

I’m not sure I get you.
Blocs created these blocs with the same ID. I closed the app and reopened it to see if it has changed, but it’s still the same.
Does it mean it’s a bug to report?

I just tried and after I try to give the same ID Blocs warns me and clears the field. If you have different behavior I’d try restarting Blocs if you haven’t. Maybe someone else will confirm?

Not sure why/how the OP got the dup Bloc IDs. To get out of this situation, maybe s/he could try following.

I tried an experiment where I had some auto defined (eg.#bloc-x) and user defined Bloc IDs. I deleted the auto defined IDs (blanked out in Blocs panel on left), saved my project, then closed out Blocs. I reopened project and all deleted block IDs were still blank in both tree panel on left and Bloc panel on right. I then did a project preview and on return to edit view, all previously blank IDs now showed an auto defined Bloc ID when selected in tree and viewed in Bloc ID on right, but did not show in tree. If I try to save the project at this point, Blocs will not complete the save, thus any new auto defined Bloc IDs are not saved. But if I try to rename one of my existing user defined bloc IDs, say back to it’s current name, I get the dup ID error message, which I close. At this point, I can now save the Blocs project and close the project. On reopen of the project, all auto and user defined IDs now show in both tree and Blocs panel.

Maybe this is something that Norm might want to look at?

I guess the OP could try to blank out all dup IDs, do a preview and go back to edit, verify new auto generated IDs, rename an existing ID back to itself, close out the error message, then do a save. Maybe that would work to get rid of dup IDs. Or the OP could just manually name all his/her Bloc IDs and save.

Hope this helps.

pruthe

Hum, that’s quite strange.
I tried to do what you told me.

Delete IDs > save > close Blocs > Open Blocs > not show IDs on the layer > preview > Show IDs on layer… everything is reclassified with all the IDs

Then I saved it > closed Blocks > open Blocs…no IDs visible :frowning:

re: OK. I saved it under another name then closed and reopened. It’s working now. The IDs are here. It seems that Blocs didn’t consider any changing that’s certainly why it didn’t really saved anything new when I saved it, but it really did when I saved under another name.

Thanks for the support :slight_smile:

Hi @Muppet,

What I did worked on my project without renaming file. I think following might have worked for you.

Delete IDs > save > close Blocs > Open Blocs > not show IDs on the layer > preview > Show IDs on layer… everything is reclassified with all the IDs. Then rename an existing ID back to itself, close out the error message, save it > close Blocks > open Blocs…should be IDs visible.

Probably not worth trying to recreate. If you have your project working again, that’s the main thing.

Have a good one! :slight_smile:

pruthe

1 Like

@Muppet what version of Blocs are you using?

Blocs won’t allow duplicate IDs, which is standard HTML. But there was a bug some time ago that was fixed rather quickly.

I’m using the last version. Blocs 3.5.3

1 Like

You can have a duplicate ID if they are on different pages. I do it all the time with mail forms when applying IDs like name, message, email etc. Very often I’ll duplicate a bloc that adds a bunch of random numbers to a field like name-76656445, then I remove them manually. It actually gets a little tedious if you have to do this on 20 pages.

Yes, but in my case it was the similar page.
I just worked on one unique page.
Fortunately I could fix the problem with the help of this great community :slight_smile: