The following warnings occurred: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
|
New Error (Can't reproduce) - Printable Version +- Form Tools (https://forums.formtools.org) +-- Forum: Form Tools (https://forums.formtools.org/forumdisplay.php?fid=1) +--- Forum: General Discussion (https://forums.formtools.org/forumdisplay.php?fid=5) +--- Thread: New Error (Can't reproduce) (/showthread.php?tid=1847) Pages:
1
2
|
New Error (Can't reproduce) - michatmaster7 - Jan 6th, 2012 Got a message from a client this morning that when trying to submit an online form, he got the following error. What does this mean? I can't seem to reproduce the error. Code: Notice: Undefined index: {field name was here} in RE: New Error (Can't reproduce) - michatmaster7 - Jan 9th, 2012 Getting reports from more and more people encountering trouble, with no idea how to help them. I've checked the code over again and can't seem to find any problems... Will go through it all one last time tonight. If it matters, I don't think any trouble started until I upgraded to 2.2.0. B RE: New Error (Can't reproduce) - michatmaster7 - Jan 10th, 2012 So upon further investigation, it seems that the error had something to do with one or two specific form fields (that happen to be different checkboxes with exact same values). Apparently, when the form processor was setup in FT admin, both checkboxes were given the same option list. I've since corrected this, so they each use a different option list now. Hopefully that corrects the problem. Here's what I mean: Code: <input name="good_sam_member" type="checkbox" value="yes" <?php if (@$fields["good_sam_member"] == "yes") echo "checked"; ?> /> Code: <input name="escapees_member" type="checkbox" value="yes" <?php if (@$fields["escapees_member"] == "yes") echo "checked"; ?> /> Both fields only have one option - "yes" - and FT thought it would make sense for both fields to use the same option list, since the option values were identical. Crossing my fingers that this solves the problem! RE: New Error (Can't reproduce) - michatmaster7 - Jan 11th, 2012 Well, after much hassle of going in and manually fixing the Field Options in FT Admin, it appears that was NOT the problem, after all. Still getting error messages from people submitting the external forms and I for some odd reason I can't even reproduce them. Something fishy going on. Not to be smart aleky, but I'm more and more certain this has something to do with 2.2.0, I'm just not sure what exactly. RE: New Error (Can't reproduce) - michatmaster7 - Jan 11th, 2012 New idea! This may be related to my validation script. Code: $rules[] = "if:good_sam_member=yes,required,good_sam_number,Please enter your Good Sam MEMBERSHIP NUMBER."; The fields good_sam_member and escapees_member are checkboxes (see my previous reply). Can you do an if statement like that? Or does the value have to be "checked" or something? It's happening now to almost all my checkboxes with only one option that have an if statement. At least I've narrowed it down a little. Update: I have reproduced the error message by NOT checking the checkboxes in question, then submitting the form. This is definitely a validation issue. I changed the validation script to: Code: $rules[] = "if:good_sam_member!=,required,good_sam_number,Please enter your Good Sam MEMBERSHIP NUMBER."; But got the same error message. Actually, the error message references line 119, instead of 114, which is to be expected. I'm guessing I simply can't use validation on a checkbox? Or at least, not this type of validation. EDIT: And this seems odd, because I KNOW I had this validation in place while using the previous version of the core. RE: New Error (Can't reproduce) - Ben - Jan 12th, 2012 Hi michatmaster, Sorry for not getting back to you sooner. Just playing catch-up now. You *may* be right it's 2.2.0 related, but I can't see the cause just yet. First off, do you have error reporting turned up high in your config.php file ($g_default_error_reporting = 2047)? If so, ANY minor warning (such as referencing a var that isn't defined - like a checkbox field that wasn't checked) will output a notice/warning in the code and prevent the API from redirecting the user to the next page. If you have that var set, a quick fix would be to just comment it out. Looking over the validation code, it actually looks like the problem lies there: I think it *will* throw a notice/warning when attempting to reference a key that doesn't exist in the $fields var (line 119). Try this: change line 119 from this: PHP Code: else if ($comparison == "not_equal" && $fields[$field_to_check] == $value_to_check) To this: PHP Code: else if ($comparison == "not_equal" && (!array_key_exists($field_to_check, $fields) || $fields[$field_to_check] == $value_to_check)) Let me know if that helps. - Ben RE: New Error (Can't reproduce) - michatmaster7 - Jan 12th, 2012 Well, after changing the validation.php code, I no longer get the error mentioned in my post. YAY! However, using the following validation rule on a test form doesn't work. I can select the checkbox in question, but the requirement doesn't prevent the form from submitting. Code: $rules[] = "if:certificates=Other,required,other_certs_possessed, Please enter the type of CERTIFICATE."; Link to test form thank you page: https://www.campmackinaw.com/secure/_test_clear.php Link to test form: https://www.campmackinaw.com/secure/_test.php RE: New Error (Can't reproduce) - Ben - Jan 12th, 2012 Heya, Hmm... interesting problem. This may be a bug, by the looks of it. Generally, the if: condition isn't used much on the server, just with the RSV client-side version of the validation, so this may be a bug that's slipped by. Could you do a quick debug and add this on line 112: PHP Code: if ($field_to_check == "certificates") Then put through a submission again, with the Certificates checkbox checked. My hunch is that it'll output an array - in which case it's a bug. Let me know! - Ben RE: New Error (Can't reproduce) - michatmaster7 - Jan 12th, 2012 I got the following output: Code: Array ( [0] => Other ) RE: New Error (Can't reproduce) - michatmaster7 - Jan 13th, 2012 Creating a new thread for post that was here as I just figured out the problem and it's entirely a different issue. |