Hello,
This is a description of my problem:
I have a link on a page to edit a specific node.
When the link is clicked, the colorbox open perfectly with the specific form for editing that node.
Now, we have 2 possibles situation:
1- The node is updated with value that are all ok for validation. So when the form Save button is pressed, the node is updated in the database and the colorbox close. Everything is OK.
2- The node is updated with value that are NOT ok for validation. So when the form Save button is pressed, the form should be reloaded in the colorbox with the field with error highlighted in red. BUT the problem is that a File Download Dialog show up.
So, is it possible for the colorbox_node module to reload the node edit form with the error message and the highlighted field that are in error ?
More details:
---------------
I have created a content type: bscourses_theoretical
I have attached the file returned when validation occurs.
If you need more details, don't hesitate to contact me!
Thanks in advance !
Regards,
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | colorbox_node.module.txt | 9.49 KB | bnetsolutioninc |
| #4 | diif_colorbox_node_module_file.txt | 3.06 KB | bnetsolutioninc |
| #4 | colorbox_node.zip | 13.42 KB | bnetsolutioninc |
| #3 | colorbox_node_module_diff.txt | 2.95 KB | bnetsolutioninc |
| #3 | colorbox_node.zip | 13.4 KB | bnetsolutioninc |
Comments
Comment #1
bnetsolutioninc commentedThe link that I use for editing the node in a colorbox contain the following parameter:
class="colorbox-node"
href="node/12/edit?width=600&height=600
Comment #2
iLLin commentedYea its possible, you just need to change the node edit form to be ajax. You will need to perform a form_alter to make that happen. You can look in the .module file and see how I did that for webforms and just follow suit.
Comment #3
bnetsolutioninc commentedThanks for your fast response!
I was able to make it work. Yes sir!!!!!!!!!!
But I have added some code to the colorbox_node module to make it work.
The code that I added to ensure everything work well for a node is in the file colorbox_node.module.
I have attached to this post the patch file (diff file).
Also, I have attached to this post the entire colorbox_node project with my modification.
I would like to know if the modifications that I have made can be part of the next release of this module.
The modification doesn't break or change the behavior for normal form.
It's only affecting when a node is displayed in the colorbox.
I think many drupal user can benefit from that code modification!
If you need more details, don't hesitate to contact me!
Thanks in advance !
Regards,
Comment #4
bnetsolutioninc commentedSorry to post again a comment.
But, after revising the code modification I made, I would like to propose you this version instead.
My previous version, was breaking the behavior for normal webform (A form that have a form_id that begin with "webform_client_form_").
With my new version, both webform and node form will work.
So, I would like to know if the new modifications that I have made can be part of the next release of this module.
Thanks in advance!
Regards,
Comment #5
drupaledmonk commentedIt would be great if you can provide a drupal patch so the maintainer can work on it easily. Anyways I will test your patch see if I can create one.
Thanks for your information. I hope it works even with image uploads in the node edit forms in colorbox.
Comment #6
bnetsolutioninc commentedHello,
I'm sorry, but I don't know how to create a patch file.
All the modifications that I have made are located in only one file.
In fact, the file is colorbox_node.module (see the attached file: colorbox_node.module.txt for uploading purpose).
With a diff tool (Beyond Compare, for example) it's very easy to find the code that was added and modified.
My developping machine is a windows operating system (with EasyPHP installed on it).
Can you indicate me how to generate the desired patch file, so I can provide it to you.
Thanks in advance!
Regards,
Comment #7
iLLin commentedThere is help topics on this that explain step by step.
Besides that, I'm not sure I want to start supporting edit forms, that's what overlay is for and is more stable than using colorbox.
Comment #8
MD3 commentedHi iLLin,
Can you link to where these help topics are? It seems like there is a lot of help out there, until you want to do a modal node/add and then the crickets start chirping.
I even tried the changes proposed by bnetsolutioninc, but it does not seem to work for me. I've tried everything out there that I can find. Admin overlay completely jacks up my theming. I'm down to CTools Auto-Modal and this article:
http://pixeljets.com/blog/improving-user-experience-using-dialogs-profil...
Is there something I'm missing?
Comment #9
iLLin commentedYou need to ajaxify your node edit form. So when you call it into the colorbox node modal, it will stay in screen. Then you need to manually manage your redirect when they submit (maybe, it might just work). This is all custom MD3, you get crickets because of that. Look at this module in the webform form alter section. That will show you how to ajaxify a form. There is lots of help topics on how to make your form ajax. Maybe you just don't have the right keywords in your search? Here is what I searched for in google "drupal 7 ajax form" here is the first thread that comes up http://drupal.org/node/752056 . Pretty good help page eh?
Comment #10
ami7878 commentedIn case someone ends up here and needs a quick solution, here it is:
Comment #11
iLLin commentedHere is a better submit handler.
Comment #12
iLLin commentedPatch to try out #2468797: Ajaxify core forms (User/Node/Login/Registration)