The following warnings occurred: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
|
![]() |
Extend "Submission Accounts"? - Printable Version +- Form Tools (https://forums.formtools.org) +-- Forum: Modules / Other (https://forums.formtools.org/forumdisplay.php?fid=8) +--- Forum: Modules (https://forums.formtools.org/forumdisplay.php?fid=16) +--- Thread: Extend "Submission Accounts"? (/showthread.php?tid=2029) |
Extend "Submission Accounts"? - Question Guy - Jun 13th, 2012 I am using the External Form API and wanting to use the "Submission Accounts" module. Right now I have separate fields for First Name and Last Name. I want the Contest Form to be OPEN/PUBLIC for the First Submission -- the Contest allows 3 separate Guesses as to a final number by a certain date of the online visits counter. The other two guesses can be submitted one at a time or in two more visits before the contest submission closing date. So, the open form should be filled in the First time with ------------ First Name, Last Name, email, telephone (for verification of location) and Guess 1 (to be required) Guess 2 (open to submission but not required now) Guess 3 (open to submission but not required now) Password (required) Submit Button ----- I was hoping to use the Submission Accounts module to take the first Submission and turn it into a "Login to Your Account" function. But when I look at the Module it only provides Email Field, Username field and Password field. What I want to do is to concat fields "firstname" and "lastname" to fill in the value of the Username Field. I GUESS I could create a new Username field with a Concat of "firstname" and "lastname" in the form itself so that the Username field is written with the combination of these two fields. But now I want to run a verification check : If the Public form is filled in again with the same telephone number or the same email address the form will not Submit. It will give the message that the Email or the Telephone number match a previous entry and that this submission cannot be Saved. And the message will then say that if they have already "Registered" then the Reply email will contain their Username and Password to Complete their 2nd and 3rd entries by Logging In. When a Contest Registrant does Log In I want them to see just one or two Guess fields available. For each Guess field that is already filled in I want just a Read-Only value. The field cannot be edited. I guess this can be done with a conditional Echo ... SO, besides Form Validation rules, in the Public form on Submit I want to check the database for any entries whose telephone or email fields match the Posted values. I know Ajax can do this on-the-fly and return Warnings before Submission. But I assume I will have to rely on PHP Server Side to catch existing Registrants from the database. Is this best done with the Hooks module or directly by altering the Submission Accounts module? Thank you! RE: Extend "Submission Accounts"? - Question Guy - Jun 13th, 2012 I have now added the following line so field "username" is hidden and composed of the First Name and Last Name submitted with no spaces. First Name : John Last Name : Taggart Username : JohnTaggart I had to gather up the Posted Values THIS way because apparently the FormTools code to re-populate fields can only return POSTED values that the user typed into the fields themselves. Therefore, for a hidden field I had to use the following -- <input name="username" type="hidden" value="<?=$HTTP_POST_VARS["fname"]?><?=$HTTP_POST_VARS["lname"]?>" /> RE: Extend "Submission Accounts"? - michatmaster7 - Jun 13th, 2012 Wow, you are certainly making this a project! While I can't imagine how you'll accomplish this (only allowing a form to be submitted a maximum of 3 times, based on the # of guesses from each and based on a specific user name), it sounds intriguing! I'm sorry I couldn't be of more help, but please post your results here when you get them. RE: Extend "Submission Accounts"? - Question Guy - Jun 13th, 2012 Hello michatmaster7. YES, much more of a "project" than I wanted. But the "special needs" is why I came here and decided to try Form Tools. What I have just now discovered is that because FormTools API is making a pre-submission, I guess, that it is impossible with the code I have for the "username" field to consistently make it submit a value to the "username" field on submit. If there are NO problems and everything passes the validation test on the first Submission then the hidden values of the "first name" and "last name" fields are NOT passed into the Username field in the database, and consequently I have no Username in such cases to send the new User. So, instead of the $HTTP_POST_VARS method I posted about previously I tried this, which is supposed to be a pretty infallible method to collect up the Posted values on Submission and stick them into other fields. <input name="username" type="hidden" value="<?php echo $_REQUEST["fname"]; ?><?php echo $_REQUEST["lname"]?>" /> BUT, FormTools API does retrieve the Posted First Name and Posted Last Name values and put them into the "username" field on a Successful Submission. IF, however, there is a Validation problem on Submission because the wrong value is in a field or a Required field should be omitted, THEN, and only then does the hidden field "username" get populated with the combined "first name" and "last name" values. I cannot pull these values from the database record because it has not been created yet. The FormTools API is a little too tricky to allow the normal Request or Post Vars methods to work as one of those would work on "normal" PHP form submissions. I am HOPING THAT BEN will suggest a way to pass along these posted field values into the database BEFORE the script is Finalized in the "thank you" page. Hint, hint..... Ben, I have tried going into the Hooks Manager and adding a Rule onto Code Hook ft_api_process_form using the smarty values {$ANSWER_username} = ({$ANSWER_fname} . {$ANSWER_lname}); which does not work to post the combined posted values of the fname and lname fields in my external form. So, now I am going to try regular old PHP but ... I am pushing a boulder uphill at the moment because the API, while versatile, is disabling the common Request vars for retrieving the fname and lname fields if the form Submission goes straight through with no problems. I just want to use those values to populate the username field in the database record. RE: Extend "Submission Accounts"? - michatmaster7 - Jun 13th, 2012 I'm not familiar with it, but have you looked at the Submission Pre-Parser module? http://modules.formtools.org/submission_pre_parser/ RE: Extend "Submission Accounts"? - Question Guy - Jun 14th, 2012 (Jun 13th, 2012, 4:12 PM)michatmaster7 Wrote: I'm not familiar with it, but have you looked at the Submission Pre-Parser module? Thanks, michatmaster7! I had seen this module earlier but did not realize that it is a more filled out set of tools to use the ft_api_process_form function. I had already tried entering a rule into the hooks module for this particular function. However, this pre-parser module has Ben's tools and examples of how such a thing should be written. So, yes, definitely, I am going to try this! Thank you! RE: Extend "Submission Accounts"? - Question Guy - Jun 18th, 2012 So, I have figured out how to do this and the submission_pre_parser module was exactly what I needed! Thank you, michatmaster7! I have also been taking a look at the "Checking for Uniqueness on Multiple Fields" tutorial and that will be the next thing I implement. I looked up the "ft_api_check_submission_is_unique" function in the Api/api.php file and, sure enough, it builds the query that is submitted to search for matching values in the database columns that already contain form entries. That saves me having to put in my own query from scratch. Thank you for this, Ben! RE: Extend "Submission Accounts"? - michatmaster7 - Jun 20th, 2012 Yay! So glad you're getting things to work. I know all too well that feeling of anxiety "I can't get it to work" - and then the EXTREME feeling of accomplishment when you figure something out finally. RE: Extend "Submission Accounts"? - WangLP - Aug 2nd, 2012 Thank you for your sharing... |