The following warnings occurred: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
|
![]() |
Keeping values in fields with ft_api_check_submission_is_unique - Printable Version +- Form Tools (https://forums.formtools.org) +-- Forum: Form Tools (https://forums.formtools.org/forumdisplay.php?fid=1) +--- Forum: API (https://forums.formtools.org/forumdisplay.php?fid=17) +--- Thread: Keeping values in fields with ft_api_check_submission_is_unique (/showthread.php?tid=315) |
Keeping values in fields with ft_api_check_submission_is_unique - msaz87 - Sep 30th, 2009 I've been working to combine validation along with ft_api_check_submission_is_unique and while it all works -- the values no longer stay in the fields on an error submission. If you remove the ft_api_check_submission_is_unique portion, it works fine. EDIT: I had to adjust the live example link... Here's the live example: http://fasports.com/az/phx/tournaments/turkey_bowl/register_TEST.php And here's the code... PHP Code: require_once("[PATH TO]/global/api/api.php"); And the code for the same thing but without the ft_api_check_submission_is_unique: PHP Code: require_once("[PATH TO]/manager/registration/global/api/api.php"); I'm assuming there's some portion of code missing that's not relaying the values in an errored submission... but I just have no idea what that might be. Thanks! RE: Keeping values in fields with ft_api_check_submission_is_unique - msaz87 - Oct 2nd, 2009 I adjusted the code a little and I think I made a little progress... by adding in the following two snippets: PHP Code: $fields = array_merge($fields, $_SESSION["form_tools_form"]); PHP Code: $fields = array_merge($fields, $_POST); Into the code as shown here: PHP Code: // no errors - great! Now we process the page. The ft_api_process_form does Now when running tests, if you error during validation, the fields don't maintain their values -- but if you only error on the name's uniqueness, they do keep their values. RE: Keeping values in fields with ft_api_check_submission_is_unique - Ben - Oct 29th, 2009 Hey msaz, Sorry for not replying sooner - I've had a pretty busy week! Would you mind posting your entire code? I'd like to see the whole shebang to see if I can spot anything out of whack. Thanks! - Ben RE: Keeping values in fields with ft_api_check_submission_is_unique - msaz87 - Oct 30th, 2009 (Oct 29th, 2009, 7:54 PM)Ben Wrote: Hey msaz, Sure thing -- thanks so much for helping me. Attached below are the two files involved (I think, its been a little while since I was working on this, so if it seems like anything is missing just let me know...) Both are included into other pages which define whether the form needs to be initialized and what ID it is... but everything else should be there. The reg_api.php file contains versions of both the working code w/out the ft_api_check_submission_is_unique and the version not working with it (one is listed as "league registration" and the other "tournament registration"). And on the confirm page, of course, is the: PHP Code: require_once("[PATH TO]/global/api/api.php"); That should be all of it.. Thanks again! [attachment=35][attachment=34] RE: Keeping values in fields with ft_api_check_submission_is_unique - PTTW - Dec 16th, 2009 I did experience this type of issue also.... I changed this: $errors = validate_fields($_POST, $rules); // no errors - great! Now we process the page. The ft_api_process_form does // the job of both updating the database and redirecting to the next page if (empty($errors)) { $fields = ft_api_init_form_page(1); $params = array( "submit_button" => "continue", "next_page" => "step2.php", "form_data" => $_POST, "file_data" => $_FILES ); $criteria = array( "attendee_last_name" => $_POST["attendee_last_name"], "attendee_zip" => $_POST["attendee_zip"], "attendee_email" => $_POST["attendee_email"], "is_finalized" => "yes", "status" => "Active" ); if (!ft_api_check_submission_is_unique(1, $criteria, $files["form_tools_submission_id"])) { $already_exists = true; } else { ft_api_process_form($params); } } } ?> to this: $errors = validate_fields($_POST, $rules); } if (empty($errors)) { $fields = ft_api_init_form_page(1); $params = array( "submit_button" => "continue", "next_page" => "step2.php", "form_data" => $_POST, "file_data" => $_FILES ); $criteria = array( "attendee_last_name" => $_POST["attendee_last_name"], "attendee_zip" => $_POST["attendee_zip"], "attendee_email" => $_POST["attendee_email"], "is_finalized" => "yes", "status" => "Active" ); if (!ft_api_check_submission_is_unique(1, $criteria, $files["form_tools_submission_id"])) { $already_exists = true; } else { ft_api_process_form($params); } } ?> and the problem was resolved!!! RE: Keeping values in fields with ft_api_check_submission_is_unique - msaz87 - Dec 16th, 2009 Can you point out exactly what you did differently? Or post more of the code? I'm trying to compare your examples and the only thing I can identify is an orphan end bracket underneath where you declare the $errors variable. Thanks |