Hi,
I’ve been thinking about using Eform for Ajax submission. I’ve never done any ajax-y things before though, so I’m not sure if I am on the right track... From my understanding of the earlier posts:
- Have a hidden option in the form, say isAjax. Set to 0 by default.
- With Javascript set the isAjax to 1 on the page for Ajax submission.
- In the snippet just do the usual when the received value of isAjax is 0.
Now... if isAjax is received as 1, then the (modified) eForm changes the form template used. Then the whole page is sent back to the browser, and Javascript would be used to extract the appropriate validation messages/thank you and put them in the appropriate places on screen.
However, if Javascript is used to extract information from the received page, then I’m a bit confused why the snippet needs to do anything differently at all. Couldn’t the same form template just be used? Thus the server-side form processing would be identical in all cases.
(Alternatively: if eForm is modified to change the form template, could the snippet maybe erase all of the document content when it is being processed if isAjax is 1? Thus the entire page wouldn’t need to be sent. Would this be possible?)
-
☆ A M B ☆
- 24,524 Posts
The first pass through the parser it changes all occurrences of [! and !] to [[ and ]] so it can be parsed as a snippet in the next pass.
Is your snippet call all on one line, no carriage returns? That can cause it to fail.
Ok, without reading this whole thread, is it possible to change the mailer eform uses? I know it uses phpMailer as a backend but the eform code seems to always set the mailer as ’IsMail’, I need to use SMTP really and set the SMTP parameters accordingly ie host etc. We could do this by letting the caller instantiate a mailer class and set the mailer accordingly then pass this as a parameter to eform, it could do the rest as normal, or we could pass these as parameters to eform but this would be a bit kludgy.
Sorry if I’ve missed something here or its been covered already, if not I’ll gladly write a patch to do this.
Any answers or thoughts here.
Thanks
Use MODx, or the cat gets it!
Yes thanks, I’ve updated to use swiftmailer as per the instructions, works a treat and gives me extra flexibilty for future usage.
This is were Modx trumps the rest, from posting the question on the forums to having a working solution on my production server took about 1 hr.
This includes trialling it on my dev server.
Didnt even have to hack any code, just replaced the files and it worked first time.
Good stuff here. I’m definitely a fanboy!
Use MODx, or the cat gets it!
-
☆ A M B ☆
- 24,524 Posts
Actually, I’ve modded the eForm snippet to use SMTP with the default phpmailer library; it wasn’t at all difficult. They have excellent documentation on their site.
I created my 1st eform page and experiencing a strange problem; the mail gets sent, but the addresses specified in the &to parameter receive it as a blank e-mail with an ’unnamed’ text/html attachment, which finally contains the data; the sender (&ccsender=1) receive it as a regular mail instead !
what can it be ?!
also how do I activate the eForm placeholders in the gotoid page ?
Ciao, thanks