I missing this place, it sure has been awhile.
I'm faced with a new project and wanted to get an idea if this was possible with chronoForm as is now before I start writing code.
I need for a user to fill out a form, get sent to an email, then approved, then sent to another email. How may I attack this? Perhaps this may be made into a new feature, hint hint๐
Hi needshelp,
I'm not clear who needs to approve what but you can do this with a couple of linked forms. Have the first form send an email with a link to the second one and use that to process the results.
Bob
User1 :: Submits form (petition) -> User2(president / support multiple users reviews) receives petition and reviews it for approval -> User1 gets the result of the petition.
Submitter submits petition -> petition is emailed to the reviewer(s) -> reviewer(s) approve or decline -> result of petition gets emailed back to original submitter.
Conceptually how would i be able to link up to forms and move results?
Hi Needshelp,
I'd probably do this with a single form.
I'd save the data in a database table at each step so that it can be recovered as needed.
I'd probably use a random string as a key in the emailed links so that each time the form is called you can look up the key in the database, get the current status and show the necessary form fields for the next step.
This is not difficult to do but it does take some PHP & ChronoForms knowledge to get it working.
Bob
Okay, I think I'm going to give it a shot. So far it goes from chrono engine form to database with a random key, the url with the unique key query is emailed to the reviewers and then they submit a boolean, in which the result is emailed to the submitter.... cake?๐
Hey GreyHead,
Update, got the info going into the database. Thank you for providing simple documentation on how to accomplish this.
I'm looking into the extra feature that you have on the ChronoForm.
domain.com/index.php?option=com_chronocontact&task=extra&chronoformname=TestForm&formkey=7ece221bf3f5dbddbe3c2770ac19b419
What I would like to know if it's best to use the extra feature or just use the regular send for the task.
So after the form is submitted I would like the above URL link to be emailed to the reviewer, my question is the following. I need to output the contents of the form based on the formkey, now when I output this do I do it in the extra task or send task. I'm wondering because I also need there to be a very small form that sends a value to the database making it approved or not approved.
So if I was to click on the above url it would show me the data of the form that was submitted and two buttons, when click it would send that value to the database.
Now if it was approved then that form needs to send out to a third party showing that the submitters request was approved.
Sorry for the repetition, just helps me think. Always appreciate the help.
Hi heedshelp,
The 'standard' ChronoForms &task=send URL used for submitting a form and has some security checks to make sure that it is a form submission. You can't use it to submit from a remote link.
The task=extra option effectively has no security checks - but also can't access other parts of the code unless you script that.
So you need to use task=extra for return links or for Ajax calls, etc.
Hope this helps
Bob
Okay so I'm getting out of this for a return link that "extra" task would be what I need to use.
The calling back of data and approval, that would have to be scripted on my own. How about the approval sending to the database, I'm assuming I will have to script this as well?
No worries. Thank's for the link I got that far, i just need to build the features now. Thanks again GreyHead always helpful.๐
GreyHead,
When emailing the link for review, how can I go about doing this. It can not be set because the reviewers will be different most of the time. Do I write the code in the after the code is submitted?
Hi needshelp,
Build it in the OnSubmit Before box, then use JRequest::setVar('url, $url) to put the result in the $_POST array. Then add {url} in your email template.
Bob
Would I be able to do something similar to set multiple dynamic emails?
The form asks for your email, and then the email of reviewer #1, and reviewer #2. Like I mentioned before the email for reviewer #1 and #2 are not always going to be the same.
Figured out the dynamic challenge. Thanks to your foresight in adding the Dynamic To, which I had no idea about. Hopefully I'll be done tomorrow. Thanks once again for your help.
GreyHead, is there away to set a php variable at the start of the form. I want to avoid using it in the "Form HTML" box, because I enjoy using the wizard and of course when you use the wizard it wipes out any custom code.
It would make a great "Toolbox" input, a custom code.
So I just used JRequest::getVar('formkey'); on the "onSubmit before" box to build the url for approval. But perhaps adding a add code through the wizard tool box would be great.
Hi needshelp ,
Not that I can immediately think of. The Wizard data is all fixed. It might be possible to have a Wizard Custom Element to import a file or something. What kind of data do you need to set and where does it come from? And how would you use it in the Form HTML?
You can workaround this a bit by having two versions of the form, one unpublished with clean Wizard code and the other with added PHP. Edit the 'clean version' then cut and paste the resulting code over to the 'dirty' version.
Bob
I see. What I wanted to do was set variable that is a random number then md5 of the form, and then call it into one of my hidden elements and then into the url that was sending out.
Instead I just set the php to echo the random md5 number into the hidden element and then JRequest::getVar when outputting before submit.
Hi needshelp,
Unless you actully need the random number in the Form HTML then you can generate it in the OnSubmit Before code box. That leaves your Form HTML clean.
Bob
GreyHead,
I was wondering if it was possible to set a unique variable for each reviewer, before email gets sent.
For example thurl.com/?unique=reviewer1 and for the second reviewer you get a second url thurl.com/?unique=reviewer2.
So if the email is being sent to reviewer one add that unique query to his specific url and so on.
Hi needshelp ,
Yes but how so you know which reviewer is which? Are they Joomla! Users? If so, the you could add their User ID to the url
Bob
They will not be registered users, the submitters inputs the email of the reviewer. So if i input [email]greyhead@chronogengine.com[/email], and [email]grehead2@chronoengine.com[/email] it would email to those both email address ultimately each url that gets emailed to both email address is different to distinguish the reviewers.
What is the variable, array or $_post for the recipients? I tried JRequest::getVar('recipients'), JRequest::getVar('dto_0'), JRequest::getVar('email_to_use'), and the simple $to variable.
Hi needshelp,
Looks like $reviewer_1 = JRequest::getVar('reviewer1', '', 'post'); should do it and ditto for reviewer 2.
Bob
true, but the main issues is at the time of mailing the email I need the url to change based on the reviewer. So when it sends out the email the email may look identical but it's actually 2 different emails because the url has a unique query to it. Is this possible at all?
Hi needshelp,
You could hand code the mail sending to do whatever you like.
To use the ChronoForms mailer I think you'd need to create several Email Setups to have one for each reviewer for a given form. So if there are always two reviewers use two setups. Then you can turn them on or off, and use different DynamicTo values and link codes for each one.
Bob
DUH!!!! makes sense, I feel like such a piece of bark. :/ If I have the two setups how do i distinguish which emails is going to what email address in order to give them different urls?
On the before send email how do I say if this email goes to email setup 1 (dynamic to) then do this url?
Hi needshelp,
Basically use a Dynamic To in each form and put reviewer1 in one Setup and reviewer2 in the other. The same with the links {link1} and {link2}.
Set the values in the OnSubmit Before box.
Bob
Got it, I have yet to test what you posted I'm going to try now.
With the above suggestion wouldn't it just send two links in the email for each reviewer? Link 1 and Link 2 to each reviewer? Since the values of the reviewers are coming from a single form?
If so, how do I setup a conditional statement that says before you email reviewer one use link 1 and when you email reviewer 2 use link ?
What I ultimately want to find out is how to change the variable based on who it's sending the email to on this single form when there are two email setups. Is there a loop I can add a condition to in the before submit that chronoFormo runs?
Thanks GreyHead.
wowy wowy, I just noticed the dual email template. AWESOME!!!!!!!!!! You sure know what you are doing greyHead. I wish I could buy you a Audi R8 right now.