PDA

View Full Version : can bad_template provide input



j-c-r-w
09-Feb-2007, 07:52 PM
I am trying to get a more comfortable use with the great formmail script and have a question about the bad_template.
I was wondering if it is possiple to provide the data of form-fields in bad_template like in the good_template. My bad_template is a copy of the form where I want the user to fill in their data directly without going back to the actual form-page.
If I use the good_template and provide for example $realname, I get the value of first and last name the user entered in the form. If I provide the $realname in the bad_template, I dont get the value, but I get $realname again. Why?

If the user misses to enter a required field i want him to be redirected to the bad_template and I want the bad_template to be exactly like the actual form where he can see his input, and maybe aside an error-message what he misses to fill in.

Is this possible in any way without using the fmbadhandler.php with its return_link?

crabtree
12-Feb-2007, 09:51 PM
I dont get the value, but I get $realname again. Why?


yeah, bad_template doesnt expand fields like that

what would u want it to do if the user didnt enter realname?

i think thats why bad_templates dont do this

u can always ask russel to implement it. u might have to dig into ur pocket tho.



Is this possible in any way without using the fmbadhandler.php with its return_link?


yeah, i think ive seen people do this....they basically do an immediate redirect in the bad_template back to the main form, using a Location header tag.

i cant remember exactly how, but u use fmbadhandler.php and $return_link to achieve it.

j-c-r-w
15-Feb-2007, 09:53 PM
thanks for your answer.
i didn't work on it the last view days, but i still can't stop thinking of it. if i have an answer i let u know.

the best for me i think would be, like in a form i saw, bad_url with the data provided and an error-message at top or bottom, so the user knows what he did wrong and can change it immediately without going back.

i will let you know if i worked it out, but any help or suggestions are appeciated.

j-c-r-w
16-Feb-2007, 05:02 PM
thanks once again crabtree,

i tried to firgure out a way to pass the information of the form throug the bad_template like in good_template, but my knowledge in programming php isn't that good like russels. Formmail is the best script i've ever seen and i understand that russel isn't going to support for free anymore. Me, i was planning to put a link into the impressum, but now i think i will wait for the paying version of formmail to hopefully get the functions i want to.

I didn't understand what you meant by "what do you want it to do if the user didn't enter realname?"

Now, if you use the fmbadhandler.php, the realname field isn't provided by the $return_link if you don't derive the realname field. So you have to change the standard functions anyway.

In the the good_template, i think it's the same, but won't be a problem at all, if it was a mandatory field, like in my form.

So, for me, contrary to russels point of view, the best error handling would be the bad_template passing the information of the form and showing an error message where you want it.
Then you could design your bad_template exactly like your form, even with the the form itself to submit again directly over the bad_template. That combined with a little error message that tells you what to change is the ultimate error handling.

Sounds complicated, but once you get your form and templates working, i think it isn't.

If anybody knows a way to get this working with the existing formmail functions or knows a particular changing of formmail to do this, please let me know.

Thanks.

david_de
16-Feb-2007, 07:14 PM
showing an error message where you want it.


So the user would, on error, get the same form back with the correct information in place and the error information marked as an error in the same location it was made?

If that is the case it would be interesting, usefull, and perhaps not that difficult. Why not submit your idea in the suggestions section?

j-c-r-w
16-Feb-2007, 07:37 PM
Hi and thanks for reply.

I will post it there. i am just trying something an want to see how this is gonna be. Maybe tommorow I have a solution. But don't count on it.

marking an error in the same location it was made could be much more tricky than an special "error area" and it would disturb the original formatting of the form, but that would be free for anybody.

But yeah, thats the plan and i think it will be great for error handling.

So may be this evening i put it in the suggestions box.

Thanks again for reply. nice that you support my idea.

russellr
16-Feb-2007, 07:57 PM
Hi,

I also support the idea of going back to the original form with the errors highlighted.

It's a nice feature and one that I'll be implementing as soon as I can.

If you're in a hurry, Gregory Keraunen has produced a modified version of Tectite FormMail which does this by default:

http://www.proliberty.com/gk_formmail/
I don't agree with everything he's done with his version, but this does do what I think you're wanting.

Of course, it also doesn't have the latest spam detection features, AFAIK.

j-c-r-w
16-Feb-2007, 08:24 PM
hi russel,

very nice that you answered my question. i'm definitly not in a hurry, the existing features are already great and the form submission and its error handling are fine for my customers.

its just the combination of the great functions in error handling you provide and the convenience for the user that i'm so interested in.

thanks a lot for the link, i will try to get behind the secret.

I will let you know how it turned out and will definitly wait for an update of formmail where the bad_template can pass the user input like the good_template. would be the easiest way. at least for me. :D

I hope a link to your site in the imprint of my site is ok for you. and i'm definitly gonna donate when i'm finished and give you the link to the final product.

thanks again for answering.

john.

russellr
16-Feb-2007, 08:47 PM
Hi John,

I can't remember how Gregory Keraunen implement his "reflexive" concept. And he made so many changes that I couldn't easily utilize the features I liked from his work.

But, the way to do this properly is to actually skip the "bad_template" completely and use an option passed to FMBadHandler.

FMBadHandler already knows how to re-load the original form with the original field data. So, in theory, it's "just" a matter of finding the fields in error and displaying an error message with them.

j-c-r-w
16-Feb-2007, 09:48 PM
hi russel,
i just had a glace at his site and didn't quite know where to start. I even didn't find the script itself for download, so i guess he is selling it?
I supposed that it must be able with your form already to do this, but i'm not that firm in PHP and don't know where to start. But through this i'm getting better and better.

I surely don't want to bother you with this and will be patient either until I got your suggestion working or you provide an update or an how-to for doing this.

I wanted to start by searching the differences between data handling in bad_template and good_template, then learning why good_template provides the data and bad_template doesn't, then trying to change the behaviour of bad_template so it will pass the data. Could I be on the right track? If you're interested in what I have in mind I can give you a link to my testpages sometime.

Thanks again, I really appreciate your answers.

John.

russellr
16-Feb-2007, 10:50 PM
Hi,

No I don't think trying to get bad_template to do what you want is the right way to go.

FMBadHandler does a huge amount of work to re-fill the fields and bad_template cannot do that.

The logic for processing errors works the way it does for good reasons, and I don't think you can tweak it correctly. It really needs a proper implementation specifically for this requirement.

j-c-r-w
16-Feb-2007, 11:07 PM
thanks for saving me time.

so I watch out for an implementaion. Are there still coming updates for the free formmail or are you planning to stop improvements like that free of charge?

not that i wouldn't pay for it. ;-)

bye and many thanks

russellr
17-Feb-2007, 12:57 AM
Hi,

We expect that FormMail will continue to be a free product.

And we'll continue to develop it further.

Being a free product, though, there's no revenue for us in it so enhancements get added at a lower priority to other work (unless someone pays for an improvement, which happens from time to time).