Jun 13th, 2012, 1:04 PM
(This post was last modified: Jun 13th, 2012, 1:37 PM by Question Guy.)
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.
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.