Bit of a weird one. I've got an install of processwire that has developed an interesting (read: infuriating!) issue.
So, this wasn't always the case, but now when you create new pages, they are given a URL name of 0. The jquery is succesfully filling in the field on the Add a Page screen, and the name value is definately being passed on to ProcessPageAdd ( I echoed it out to make sure ) but somewhere beyond that it is being changed to the number 0. (Ok so technically speaking 0 is not a number but whatever )
Obviously this is causing issues as now if you create another page on the same level under the same parent page, it throws the following error:
"TemplateFile: Duplicate entry '0-5766' for key 2 INSERT INTO pages SET parent_id=5766, templates_id=40, name='0', modified_users_id=2, status=2049, sort=3,modified=NOW(), created=NOW(), created_users_id=2"
The interesting thing is that if you go back to edit the previously created page with URL name 0, and change the URL name to something more suitable, when you save it it now gives it a URL name of it's page ID. Only if you go back and edit a second time will it keep whatever string you give it as a URL name.
Yeah.... what?
So, to illustrate what is happening with an example:
Lets say I create a child page of my page called Blog. I call it "Test Post".
As I type this in, the field below (URL name) is automatically filled with the slug: "test-post".
However when I save the page, and check under the settings, I see that the URL name is given as 0.
So, I manually change it to "test-post" and press save.
I look again and it is "5567" - the page id.
So I change it once more and this time it sticks.
Any thoughts? Where should I be looking for the problem?