Post new topic Reply to topic  [ 7 posts ] 
 Post subject: How can I make a field mandatory?
PostPosted: 2009-06-12 (14:43) 

Joined: 2009-06-09 (21:41)
Posts: 4
As it stands now, the fields "Comment" and "Name" are mandatory and the form will not submit until those fields have been filled out. I want to make the "email address" field mandatory as well. How can I achieve this?
Thanks in advance!


Top
 Profile  
 
 Post subject: Re: How can I make a field mandatory?
PostPosted: 2009-06-12 (21:09) 
Site Admin

Joined: 2003-07-27 (00:49)
Posts: 7351
Just un-coment (remove the two slashes) this line in /configuration/comment_form.inc.php:

Code:
//$g7k_form->addRule('email',     $g7k['text']['txt_valid_email'],    'required');


Ralf


Top
 Profile  
 
 Post subject: Re: How can I make a field mandatory?
PostPosted: 2009-12-14 (18:35) 

Joined: 2009-12-14 (16:56)
Posts: 10
Location: France
I have applied this to the email and title fields to make them mandatory but now I would like the labels of these 2 fields to be displayed in bold like the others when they are missing. How can I add this effect please?

Thank you very much for your help.

Christele


Top
 Profile  
 
 Post subject: Re: How can I make a field mandatory?
PostPosted: 2009-12-18 (21:25) 
Site Admin

Joined: 2003-07-27 (00:49)
Posts: 7351
Code:
{if $form.email.error} <span class="g7k_error_message">{$form.email.error}</span> {else} {$form.email.label} {/if}


Ralf


Top
 Profile  
 
 Post subject: Re: How can I make a field mandatory?
PostPosted: 2009-12-21 (13:42) 

Joined: 2009-12-14 (16:56)
Posts: 10
Location: France
Sorry Ralf I posted this message in the wrong forum, I am using the Comments script, not the Guestbook one. My mistake.

But if it's not a problem for you, could you please let me know where I can add a bold effect on the mandatory fields in the Comments script?

Many thanks in advance :)


Top
 Profile  
 
 Post subject: Re: How can I make a field mandatory?
PostPosted: 2009-12-21 (13:59) 
Site Admin

Joined: 2003-07-27 (00:49)
Posts: 7351
It's the same for the comment script. Just look at the error message of one of the other fields and apply it to the e-mail field.

Ralf


Top
 Profile  
 
 Post subject: Re: How can I make a field mandatory?
PostPosted: 2009-12-21 (17:42) 

Joined: 2009-12-14 (16:56)
Posts: 10
Location: France
Thanks I found my error, it was coming from the Template comment.tpl.html file, I forgot to apply the <span> error message to the name of the fields.

Now all the error messages of each field are displayed in bold.

Thank you for your help.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Resources:   Schwerin    Private Krankenversicherung    Krankenversicherung    Website Tools Collection    Speed Camera Database    Radarfallen-Datenbank    Speed Camera Database    Teeny Weeny URL
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Translated by Xaphos © 2007, 2008, 2009 phpBB.fr