path disappears after previewing node
aarakast - May 25, 2008 - 09:55
| Project: | Pathauto |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | dropcube |
| Status: | closed |
Description
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.

#1
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.
#2
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...
#3
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_callbackset toFALSE(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.
#4
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_nodeapipresave.#5
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..
#6
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 ?
#7
Ok ;) That works now. Thanks for that!
Should I now create a new issues concerning the checkbox?
#8
@aarakast - no need to create a new issue, see #180440: If an alias is manually created, don't automatically replace it on edit.
#9
Re-rolled. Will test now.
#10
I don't see anything wrong with the code, and it works as advertised.
#11
rerolled one last time...and committed.
Thanks Dropcube and Freso!
#12
Automatically closed -- issue fixed for two weeks with no activity.