If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Enjoy an ad free experience by logging in. Not a member yet? Register.

Arguments after "description" are optional. The last three should be either int or float. If the type is "textarea" the $size argument should be a two element array (width, height).
The types are: text, password, textarea, radio, checkbox, select, number*, email and submit.
It returns bool(true) or int(-1) if an element with the same name exists.

To add options to the select or radio element you use the add_option() method.

PHP Code:

$form->add_option('name of the select element to which this option belongs', 'the returned value', 'the value presented to the user');

The last argument is optional. The value of the 2nd argument will be used if it is not set.
It returns bool(true) or bool(false) if there is no select element with the given name.

The make() method returns an array with the form. It return an array so you can add whatever you like inbetween the fields.

PHP Code:

$form->make(/* show errors */ true);

The argument is optional and defaults to true. It will print errors below the form elemnts that were filled in incorrectly.

The class got updated.
There is a new size argument for the add() method.
Checkboxes got added (sort of).
Lables were added to radio and checkbox elemnt types (Do the other need them?).
The return values changed in the check_submit() method.
The example was updated aswell.

Everything which goes around any the form elemnts was left for you to add. That's why the form is returned in an array.

Last edited by marek_mar; 12-05-2005 at 12:32 PM.

I'm not sure if this was any help, but I hope it didn't make you stupider.

Updated it again.
- Everything has a label now.
- A new method was added (form::raw()) to add things between the form elemnts (if you're too lazy to do it with the array that form::make() returns). Anything there will not be validated even if it's a form element. Adding form elements with raw is not suggested as they may break other form elements.

I'm not sure if this was any help, but I hope it didn't make you stupider.

Ok I did a big update to this class (mostly bugfixes though).
- Label tags are SPELLED correctly this time.
- Fixed the way checkbox values are returned by form::get_valid_values().
- You can now select checked/selected by default radio/option.
- File field has been added ($max argument checks for the filesize).
- Probably some other details I don'tremember anymore.

does any one of you admins know what's up with user marek mar, initiator of this class?
I tried to pass over a PM to him but his PM storage seems to be overloaded already.
Last activity was about two years ago.

Just wonder if anyone knows something as I would like to contact him due to license questions.