The following warnings occurred: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
|
Problems with tutorial and repopulating fields - Printable Version +- Form Tools (https://forums.formtools.org) +-- Forum: Modules / Other (https://forums.formtools.org/forumdisplay.php?fid=8) +--- Forum: Form Validation: JS + PHP (https://forums.formtools.org/forumdisplay.php?fid=18) +--- Thread: Problems with tutorial and repopulating fields (/showthread.php?tid=321) |
Problems with tutorial and repopulating fields - jclermont - Oct 6th, 2009 I studied the tutorial at http://docs.formtools.org/tutorials/php_validation/ to setup server-side validation. I had no trouble getting the validation to work by following the tutorial exactly. However, if the validation rules failed, it would not repopulate the fields that the user had submitted. In particular, if I output the contents of $fields like this: PHP Code: $fields = ft_api_init_form_page(5); the only two values would be the form id and submission id, but none of the user data. I was able to get it working as desired, but I had to deviate significantly from the tutorial. Here are the changes I made (I add comments to the areas I deviated from the tutorial code): PHP Code: require_once("formtools/global/api/api.php"); Is my approach valid? Did I miss something obvious in the tutorial? RE: Problems with tutorial and repopulating fields - jclermont - Oct 13th, 2009 Any opinion on this one? Looking forward to some input. Thank you. RE: Problems with tutorial and repopulating fields - jclermont - Oct 26th, 2009 Anyone willing to take a few minutes and respond to this? Either I'm missing something obvious, or there are likely other people who will be frustrated with the published tutorial in the documentation. RE: Problems with tutorial and repopulating fields - Ben - Oct 29th, 2009 Hi jclermont, Sorry for the wait - very busy week! Yes, your approach looks fine - it's actually not bad at all! The only thing I'm not terribly thrilled about is calling the ft_api_init_form_page() function twice... nevertheless, it'll work fine without any side-effects that I can see. The tutorial DOES needs updating - I'm very sorry for all the confusion its created. I'll make sure it gets done this Saturday. Thanks for the very clear posts, jclermont! Very helpful! - Ben RE: Problems with tutorial and repopulating fields - jclermont - Oct 30th, 2009 Thanks Ben! I look forward to seeing the solution you come up with. I must say that I'm very impressed with FormTools. I'm going to study the code more, then pitch in and help with some of the open bugs on your issue tracker. RE: Problems with tutorial and repopulating fields - MatthewHenry - Sep 30th, 2020 Problems with tutorial and repopulating fields are hard to find that is the reason many developers want help. It is a great place to find the help from the top professionals here. When i read the 99papers I come to know that it makes us easy to find a solution. |