nothing happens
xamount - May 2, 2008 - 19:27
| Project: | Ajax |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | brendoncrawford |
| Status: | closed |
Jump to:
Description
When i enable this module and then set it to ajax-validate for node types, nothing happens. The node creation appears to validate as normal (page refreshes as normal). I am using drupal 5.7 and the JSON module is enabled in php (version 5.2+).

#1
I can't get it to work either. Tried to debug a little bit then gave up figuring that a project that someone posted and then couldn't be troubled to show up to check on it again isn't worth my time...
#2
Switching to critical since the module doesn't appear to offer any functionality at all.
#3
in function
<?php
function zzzz_ajax_validation_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
// added by vinayras
if ($op == 'prepare') {
drupal_add_js(drupal_get_path('module', 'zzzz_ajax_validation') . '/AjaxValidation.js', 'module');
}
// end of addition by vinayras
..... ...
?>
After adding these code AJAX validation works fine.
But still, if all data is correct - form is not getting stored, and page refreshes with all data.
Can anyone give some pointers?
#4
I have not actually looked at the code in the module yet due to time constraints so this is just a stab in the dark...
Add your line of code for
$op == insert/update/submit/validate
Play around with these cases and see what happens.
#5
wow this module could be very useful if it worked. . . and if it wasn't coded to ONLY validate node type forms. for example, it claims to integrate well with thickbox, but by far the most useful place for it to be implemented w/ thickbox would be the thickbox login, already packaged and good to go with the main thickbox module.
i can't use thickbox login on a production site b/c the validation doesn't work, and thought this module might do the trick. instead it only even tries to work on node type forms, and doesn't even appear to do that properly.
would love some pointers / suggestions on fixing this module and in making it accept ANY form_id.
#6
I got this module working as per my needs. But it took me too much time to figure out the problem.
Problem is: When you press submit, data is sent to server for validation. Drupal processes those data - and if everything is fine, "true" status is sent by function 'zzzz_ajax_validation_go'. Now, since Drupal system validates forms using tokens, the form for presently loaded token has already been submitted - due to this Drupal does not process the same form again ( when actually form is submitted by AJAX Validation)
To solve this, i got a work-around to suit my requirement.
In zzzz_ajax_validation.module
I modified function zzzz_ajax_validation_nodeapi()
change
<?phpzzzz_ajax_validation_go();
?>
to
<?phpzzzz_ajax_validation_go($node->type,$node);
?>
Then, I modified function zzzz_ajax_validation_go as per my need
<?php
function zzzz_ajax_validation_go($type,$node) {
drupal_get_messages(null, true);
$form_errors = form_get_errors();
$data = zzzz_ajax_validation_buildOutput($form_errors);
//add by vinayras
if($data["status"]) {
/*
If everything is fine - i.e. no errors in form, save the node, and return node url
*/
$node = node_submit($node);
node_save($node);
$url = url("node/$node->nid");
$data["goto"] = $url;
}
// end of additions from vinayras
header("Content-Type: application/json; charset=UTF-8");
print json_encode($data);
exit;
}
?>
And in AjaxValidation.js
//formObj[0].submit(); // comment thiswindow.location = data.goto; // add this
Right now, my form is working fine. I was loading form in a thickbox, and all validations were done over there. Once, form is submitted, user it taken to recently added node.
Hope this explanation helps.
Vinay
#7
Even after Vinay modification nothing happens :( It's really pity
#8
Just found a very quick and easy fix.
I have noticed that in my case none js file was appended to the node submission page, so at the zzzz_ajax_validation.module in the hook_nodeapi(); move line
drupal_add_js(drupal_get_path('module', 'zzzz_ajax_validation') . '/AjaxValidation.js', 'module');just before the beginning of if statement.Looking for the way to fix that in a better way
#9
Hey guys,
I have been busy porting this module to Drupal 6. Thanks for being patient. I will be addressing this issue soon.
Caleb G, instead of getting bent of shape, perhaps you could post a fix next time.
#10
I don't know if this helps anyone, it seems to require JQuery1.2.x (I got it working with 1.2.6). I was using Jquery 1.1.2 (came with JUpdate module, figured this would be the latest JQuery) as otherwise the serializeArray function is not defined and it doesn't work. Also, the AjaxValidation.js was not loading, the module has itself only loads on 'view' for a node, I changed this to prepare on line 49 and it seems to work for me, although it is still not submitting properly, it is validating and marking errors, I guess that is the next thing to look at...
-- if ($op === 'view' && $a4 === true) {++ if ($op === 'prepare') {
#11
Talk about ignoring the work of others...just saw vinayras's modifications which work perfectly for me too (although he didn't have my JS problem). Can I suggest that his changes be added to the distributed version.
#12
Brenton,
There is no need to get rude. The problem here is that there have been about 3 different bugs which have been brought up. So, one persons solution is not not going to necessarily fix the problems that others are having.
#13
CalebG, Vinayras, xamount, vegeneric, mixey, brenton,
The module has now been fixed as per all of your feedback. I have fixed all known issues that have been addressed in this issue. Please test and let me know if it seems to work better.
Thanks,
Brendon
#14
Sorry Brendon,
Tone wasn't meant to be rude, good module and appreciate the hard work.
#15
Automatically closed -- issue fixed for two weeks with no activity.