Author |
Message |
17/04/2004 18:48:43
|
cndgirl
Beginner
Joined: 17/04/2004 18:27:27
Messages: 13
Offline
|
I have read a few posts on how to add and delete fields in guestbook. But my question is,,,,,, how do i make a field a requirment?
What I'd like to do is make email field a requirment to beable to sign guestbook. if someone could please guide me with what to do or possible have code so i can do this.
Thanks in advance
|
|
22/04/2004 09:34:37
|
cndgirl
Beginner
Joined: 17/04/2004 18:27:27
Messages: 13
Offline
|
No one can help me with this?????
|
|
22/04/2004 13:13:23
|
Anonymous
|
Hi cndgirl,
A few weeks back I posted a message about changing the required fields - it's here...http://proxy2.de/forum/viewtopic.php?t=2877&highlight=required+fields&sid=f7d5445820f567874b38e8e3c859a4f0
Although not exactly what you're looking for you should be able to tweak it to get what you want.
Let me know how you get on - email to 042204a at kahlil dot org if you wish.
Hope it helps.
Trevor
|
|
22/04/2004 19:56:15
|
Anonymous
|
Thank you for the reply Trevor. What I'd like to do is make e-mail address on the book a required field.
|
|
23/04/2004 17:08:02
|
Anonymous
|
OK, here's some step by step instructions, apologies if some of this is a bit basic.
First off, not a bad idea to make copies of the existing files - the files that will change are add.class.php in the lib sub-directory, form.php in the templates sub-directory and english.php in the lang sub-sirectory (english.php if your guestbook is in English, otherwise the language of your guestbook - french.php, italian.php etc).
These notes are for making e-mail a required field. If you want to make location a required field follow the same instructions but substitute email with location, to make homepage required substitute email with url.
MAKING E-MAIL REQUIRED
1 Open add.class.php in the lib sub-directory.
2 Find the following text (about lines 189 to 191)
3 Copy it and paste it in a couple of lines later, after where it says...
4 Change name to email and ErrorPost1 to ErrorPost12.
5 That whole bit of script with the new lines added should read...
if ($this->name == "") {
return $this->db->gb_error($this->db->LANG["ErrorPost1"]);
} elseif (strlen($this->comment)<$this->db->VARS["min_text"] || strlen($this->comment)>$this->db->VARS["max_text"]) {
return $this->db->gb_error($this->db->LANG["ErrorPost3"]);
} else {
if ($this->email == "") {
return $this->db->gb_error($this->db->LANG["ErrorPost12"]);
}
$this->url = trim($this->url);
6 Save that file and open form.php in the templates sub-directory.
7 Find the following text (about lines 18 to 21)
8 Copy and paste it in immediately after where you've just copied it from
9 Change comment to email (twice) and ErrorPost2 to ErrorPost12.
10 It should now read as...
ADD ASTERISKS TO INDICATE REQUIRED FIELDS
11 Still with the same file open (form.php) find the following (about line 92)...
12 All you're doing is adding an asterisk after [FormEmail] so it now reads...
13 Save the file.
CREATING A NEW ERROR MESSAGE
14 Open the file english.php in the lang sub-directory.
15 Scroll down to about line 72 and create a new error message based on the existing ones.
16 For example, copy and paste the following...
and edit it to read...
The message can be whatever you want, the important thing is the make sure it's numbered as ErrorPost12.
17 Save it and you're done.
MAKING MORE FIELDS REQUIRED
If you wanted to make more fields required (e.g. location) just repeat the above substituting name for location and ErrorPost11 for ErrorPost13 (create ErrorPost13 as per steps 14 to 17 above).
MAKING FIELDS SO THEY'RE NOT REQUIRED
Refer to this massage...
http://proxy2.de/forum/viewtopic.php?t=2877&highlight=required+fields&sid=f7d5445820f567874b38e8e3c859a4f0
That's it - hope it works. Any probs post another message or e-mail me: 042304b at kahlil dot org
Trevor
|
|
05/05/2004 06:23:04
|
cndgirl
Beginner
Joined: 17/04/2004 18:27:27
Messages: 13
Offline
|
OMG Trevor I am so sorry, I didn't know you had replied to this post, I didn't get a email notifaction Please forgive me. My guestbook has disappeared but if I ever get it back I'll make sure to follow your steps. Thank you very much once again for your time and help.
|
|
|