Page 1 of 7

Bonus Forms

PostPosted: Fri Apr 29, 2011 10:10 am
by marcelfw
This extension provides all the basic form elements in HTML, provides basic validation (required, some types, regexp) and provides a few basic actions, like 'hashcash protect' and 'mail' (the other two or 'validate' and 'message').

Because this extension has been build with the knowledge that you can never incorporate every wanted feature in any form system. It has been build to be extended to add new elements, new validations, new actions and new standard forms. Even the features it provides by default are created using the same framework, so there are a lot of examples you can choose from to build your own.

Version 0.15 has been released (supports UTF-8 in mail)

Re: Bonus Forms

PostPosted: Wed May 04, 2011 4:39 pm
by danielschut

Hmm. I get this error where I try to embed it:

Smarty error: unable to read resource: "/home/polethecon/domains/": 512Smarty error: unable to read resource: "/home/polethecon/domains/": 512Smarty error: unable to read resource: "/home/polethecon/domains/": 512Smarty error: unable to read resource: "/home/polethecon/domains/": 512

I'm trying to figure out what it means. Any advice? Thanks in advance!

I must say, I understand there's not much documentation, but a one-page step by step instruction for installing and set-up would be very much welcomed! :)

*ETA 2:
Look, I'm getting somewhere! :) See:

How and where can I format the buttons and activate them, because now they don't seem to work... Thanks in advance again!

Re: Bonus Forms

PostPosted: Thu May 05, 2011 7:29 am
by marcelfw
The directory shown says ../extensions/extensions/bonusforms/.. that's twice 'extensions', can you check if you directory layout is correct? It should be pivotx/extensions/bonusforms/..

I will add some more documentation for the initial setup. However, the extension already provides 'Add standard form', which should set you up with two forms you can later customize.
A specific question, the 'submit' and/or 'reset' buttons are automatically added when you enter a title for them on the form-meta screen. In the future it will be possible to really customize the buttons, but for this initial release, it's only possible to add those.

To style the form you really need to add your own CSS, this will be in a later release of course, but it's just not ready to release right now. You can assume most field-elements just have a 'label'-tag or a '.label', with the input element after that in the HTML. Only radio's and checkboxes require some exceptions from that.


Re: Bonus Forms

PostPosted: Thu May 05, 2011 12:30 pm
by marcelfw
New version uploaded (0.2).

Documentation suggests you use the 'Add standard form' and play with that before trying to setup your own form. Also some other documentation updates, but it still far from perfect.

Added a default CSS for forms. Forms should at least look a bit better initially. Styling is light and can be easily overwritten in your of CSS.

Adding 'spamprotect' action without enabling it should work now.

Re: Bonus Forms

PostPosted: Thu May 05, 2011 3:16 pm
by danielschut
Ah, that looks a lot better already:

Thank you so much!

Some more questions:

- I'm not quite sure what the spamprotection entails. If currently, you fill in a valid message, but the message is all spam (I tried it with some curse words and the word viagra), the form still sends it and I still get the mail. Is that the way it was intended?

- How and where can I change the length of the entry-field for the text? I'd like it to be a bit longer.

- If I want people to fill in their phone number in a seperate field, how should I do that? Eventually I'll recieve the phone number as part of the email body, obviously

- a more difficult question: how can I be sure a hacker doesn't break into this form and starts using it for sending spam to other people? That has happened with my previous (non-pivot) website back in 2004.

Again, thanks, it's really handy!

Re: Bonus Forms

PostPosted: Thu May 05, 2011 3:50 pm
by marcelfw
Nice, looks good!

1 / 4.
Spamprotection is meant to block spammers from using your script to mail other people (your last point). It requires a spammer to execute the included javascript to generate the correct number which can be verified on the server side, this is called a hash-cash. It doesn't disable a spammer which puts in a bit of effort to use the form, but it does slow him down and he would more likely look for weaker forms to hack. It's the same protection PivotX uses for comments, only a (much) newer version of it. Also, as a side effect the module only allows an X number forms to be submitted in a certain timeframe, but that's currently only a side-effect.
In the future I could add real form throttling, or IP-blocking etc. For now this hashcash-check should be enough.

You should add CSS statements in your own styleshee, targetting the div.input and the input's themselves. There is no way to add a 'size' or 'maxlength' at the moment.

Just add a new field, by clicking the [Fields] button, choose 'text' and on the next screen enter the details.
Try to the form first, before you continue. Until we have an extension to this extension to add a 'phone-type' you could use
a regular expression to check for phonenumbers. Try this only when this field works, otherwise it will be hard to spot what's wrong.
You could enter a regex like this:

|^[-+ 0-9]{10,13}$|

It's far from perfect but it only allows generic phonenumber characters (numbers and dashes etc) and requires a total string length of 10 to 13.
You should enter a specific textmessage below the regex field '- invalid message' that contains something "You must enter a phonenumber".
The "mail" action automatically mails every field that has contents in it.

Should be answered at number 1.


Re: Bonus Forms

PostPosted: Thu May 05, 2011 5:19 pm
by danielschut
Hi marcel,

thanks a million!

This is what the standard contact form looks like now:

I've tried to do all kinds of stupid thing with it, like fill in half emailadresses and what not. Still worked perfectly, so thanks!

My next step: I'm going to create forms for the seminars I'm going to give. Will show you once done.

Re: Bonus Forms

PostPosted: Sat May 07, 2011 2:11 pm
by danielschut

Well, still testing ;)

When I fill in the help text in a field, instead of the help-tekst, it just shows the letter 'i' next to the textfield, before the button. No link or hovertext visible, at least in Chrome.

Re: Bonus Forms

PostPosted: Sat May 07, 2011 3:45 pm
by danielschut

When you add a checkbox field and make this field 'required', there's no error-message tied specifically to this field. It shows the general 'alle velden moeten verplicht worden ingevuld', but not 'this field is required' next to the specific field.

If I use a radio-button, somehow the button doesn't pass any information in the email I receive. I'm not sure what the function of the radio-button is then.


Re: Bonus Forms

PostPosted: Mon May 09, 2011 8:02 am
by marcelfw
Required doesn't work for checkboxes yet. From the form-standpoint it useless, but I agree, there is a use for it when you want things like 'I agree to the terms'. Will fix.

What did you enter in the 'Text' field (below 'Source')? It should be a list of options. I will add help because I see it's missing completely ;)

In 'Text' you should add the options in the following format (two variants):

Code: Select all
name                              <- value is set to the name as well
value :: name                     <- this is the regular form
value :: name :: group            <- in select this is an optgroup

The same format is used for select's. An example:

Code: Select all
apple :: My favourite snack is an Apple
chocolate :: I like chocolate

In the future other 'Source's will be things like SQL statements or PHP callbacks (just like bonusfields already has, in a different form).