The following warnings occurred: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
|
Can one dropdown selection populate two fields? - 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: Can one dropdown selection populate two fields? (/showthread.php?tid=5136) |
Can one dropdown selection populate two fields? - lolekbolek - Apr 23rd, 2015 I have a form that clients from various branches use to request service visits. Once they filled out the online form, it sends them an email confirmation. However, it only sends it to the person who filled out the form, because I only ask their own email address, to keep things easier. Branch Location - dropdown Requester Name - textbox Requester Email - textbox I believe I should have a behind a scene table created that would list each branch location together with one associated main email address. What I want to see as the result, is for a client to select his branch location (for example - Springfield) from a dropdown, and have both the "Branch Location" AND the "Branch Email" field automatically populated in the form, so that an email confirmation can be sent to both the requester and his branch. Can I do that? Thanks! RE: Can one dropdown selection populate two fields? - ADaniel - May 6th, 2015 If you are using internal forms, the short answer is yes you can do that. Actually doing it, tho', takes a little time and custom code. I use this method quite a bit in my forms, to fill in email fields ( or other fields) stored in other forms (tables) based on selections made by the user when they fill out the current form. It requires the use of the Hooks Manager, and embedding php and html code within the proper hook. Then when the user presses "Update", the hook calls the code you've created that opens another table, locates a record matching your specified criteria, and updates a specified field in your current form submission with the data you want. In the Hooks Manager, I use this hook "ft_update_submission, start" when I am 'post-filling' the form with data based on user selections/responses, and embed my custom coded php and html there. To summarize, what happens in the forms I am designing is: the user fills in the form, clicks "Update", the hook and custom code kicks in and fills in other information from another form(s) (table), the screen refreshes, the user sees the message "Your form was successfully submitted", and sees the form again -- now complete with the added information. Also, to 'pre-fill' or pre-populate a form with data I use the hook "ft_create_blank_submission, end" and place whatever code I need there. When a new submission is created and displayed, it will be pre-filled with whatever information I've specified in my hook, and that information may be pulled from data that was entered in several other forms (tables). RE: Can one dropdown selection populate two fields? - lolekbolek - May 29th, 2015 Many thanks! Is there any chance you could share your custom code? People like me, who are not programmers, would certainly benefit from your expertise! RE: Can one dropdown selection populate two fields? - andy_12-12 - Jun 23rd, 2015 (May 29th, 2015, 12:01 PM)lolekbolek Wrote: Many thanks! Is there any chance you could share your custom code? People like me, who are not programmers, would certainly benefit from your expertise! Any chance of some sort of example. I am trying to get an record id drop down to pull a name through from the same table. Any advice would be very much appreciated. |