After showing the preview of a node, the edit-path input field is empty if you have defined an individual path for that node, after saving the idividual path is overwritten bei the automatic entered path.

Comments

greggles’s picture

Component: User interface » Code
Status: Active » Needs work
StatusFileSize
new1.33 KB

Thanks for the report - I can confirm this issue and also found that the state of the "perform pathauto alias" checkbox is not remembered.

I tested the edit-path problem after disabling javascript and found that the form value is persisted. So, one option would be to use some jquery to un-disable the edit-path or we are either going to have to add some logic that sets it to the proper value on a preview.

For the checkbox, I think that instead of #default_value => TRUE we should consider using the $form['#node']->pathauto_perform_alias) value if it isset.

This attached patch covers the second problem.

greggles’s picture

Also, this only affects 6.x - so perhaps there is something wrong with the way that the form_alter was upgraded from 5.x and this could be fixed more simply...

dropcube’s picture

Also, this only affects 6.x - so perhaps there is something wrong with the way that the form_alter was upgraded from 5.x and this could be fixed more simply...

The problem is that in 5.x, the node is submitted for preview using a button, form element, and not a submit form element. The button> element has #executes_submit_callback set to FALSE (see system_elements, which means that the form is not really 'submitted', it is re-built with the submitted values. The path is not submitted beacuse the field is disabled, but the node path is used as the default value.

However, in 6.x, the preview button has its own submit handler. When summited, the form is proccessed and the node values are overwritten with the form values. For this reason, the path value is lost when the field is disabled.

dropcube’s picture

Version: 6.x-1.0 » 6.x-1.x-dev
Assigned: Unassigned » dropcube
Status: Needs work » Needs review
StatusFileSize
new1.82 KB

Here is a patch that fixes this. The path is saved in a form value and restored back to the text box after the form submission, following a similar hack to the one used in the pathauto_nodeapi presave.

Anonymous’s picture

For me it still doesn't work...
node -> edit -> uncheck "automatic alias" -> enter new alias -> save -> edit node -> save -> new alias is replaced by autoamtic alias
While editing the second time "automatic alias" is checked again..

dropcube’s picture

This issue is related to persist the values of the checkbox and the path when submitting a node for preview, like it works in 5.x versions. Did you test the node preview as you reported initially ?

Anonymous’s picture

Ok ;) That works now. Thanks for that!
Should I now create a new issues concerning the checkbox?

greggles’s picture

Freso’s picture

StatusFileSize
new1.87 KB

freso@nayru /s/h/l/h/d/s/a/m/pathauto> patch -p0 < pathauto_node_preview-262464-4.patch
patching file pathauto.module
Hunk #1 FAILED at 261.
Hunk #2 FAILED at 286.
2 out of 2 hunks FAILED -- saving rejects to file pathauto.module.rej

Re-rolled. Will test now.

Freso’s picture

Status: Needs review » Reviewed & tested by the community

I don't see anything wrong with the code, and it works as advertised.

greggles’s picture

Title: Individual path is away after opening preview » path disappears after previewing node
Status: Reviewed & tested by the community » Fixed
StatusFileSize
new1.94 KB

rerolled one last time...and committed.

Thanks Dropcube and Freso!

Anonymous’s picture

Status: Fixed » Closed (fixed)

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

JacobSingh’s picture

Version: 6.x-1.x-dev » 7.x-1.0-beta1
Status: Closed (fixed) » Active

I'm seeing this in 7.x-beta1.

s.t.r are the same,
node/add/article
preview
submit

Although now the "auto alias" box is checked, but no alias is created after a preview

JacobSingh’s picture

that is after a preview and then a save

dave reid’s picture

Status: Active » Postponed (maintainer needs more info)

Please re-check using the latest 7.x-1.x-dev as this should have been fixed with #955926: Path not linked to node id after previewing then saving node

dave reid’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

And I'm very sure that it's fixed with that, so I'm going to mark this back as closed. Please re-open 955926 if it is not in fact fixed.

JacobSingh’s picture

Aw good. I searched for preview a couple times and didn't see that one come up. My bad. Thanks for the fix.