Forums / Developer / Problems with form validation

Problems with form validation

Author Message

Markus Bader

Tuesday 20 March 2007 3:58:12 am

Hello together!

I am working on a site which uses the plain site (means I do not have the class "Feedback form") and I am trying to build a contact form. Unfortunately this topic is not well documented, so I please you to help me.

I have already made a class and a template, which looks like this:

<i>
<form method="post" action={"content/action"|ezurl}>
<input type="hidden" name="TopLevelNode" value="{$node.node_id}" />
<input type="hidden" name="ContentNodeID" value="{$node.node_id}" />
<input type="hidden" name="ContentObjectID" value="{$node.object.id}" />
<input type="hidden" name="ViewMode" value="full" />

Name
<input class="inputbox" type="text" name="ContentObjectAttribute_ezstring_data_text_309" value="" /><br/>
<br/>

{* other input boxes *}

<input type="checkbox" name="ContentObjectAttribute_ezstring_data_text_316" value="" /> Ich möchte bei neuen Aktionen informiert werden<br />
<br />

<input type="submit" class="button" name="ActionCollectInformation" value="Abschicken" />

</form>
</i>

The problem is that I have to fill all Elements of the form (including clicked checkboxes) to send the form. If just one entry is missing, nothing happens.

I copied templates named <i>content/collectedinfo_validation.tpl, content/collectedinfo/form.tpl and content/collectedinfomail/form.tpl</i> into the template directory of my extension, but again this effects no change.

What I need is a possibility to control, which form elements have to be filled and which not. I hope you can help me.

Thank you!

Markus

(from Germany, known for bad English ;) )

luca maroni

Sunday 25 March 2007 8:28:40 am

You can set which attributes of your class are required and which not.

If you'll try to edit your custom class for the "feedback form", you see that for each attributes you have a "required" check box. please select that check box only for the required attibutes.

I think this can solve your problem.

Bye bye
Luca
( Spaghetti English ;-) )