Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Help Groups for Snitz Forums 2000 Users
 Help: General / Classic ASP versions(v3.4.XX)
 Making fields required when users update profile
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

betheball
Starting Member

USA
41 Posts

Posted - 11 December 2002 :  15:44:11  Show Profile
I have successfully made several fields in Register.asp be required fields. However, I read a comment by FrutZle in another post where he says that changing Register.asp won't prevent people from deleting the information when updating the profile. So, my question is, what other changes do I need to make so the fields are also required when updating a profile. Is it in pop_profile.asp? Here is the code I pasted into Register.asp:

If Trim(Request.Form("Firstname")) = "" then
Err_Msg = Err_Msg & "<li> You must enter a valid first name.</li>"
end if


Can I paste this same code into pop_profile.asp or whatever page I need to edit? If so, where should I paste it?

One last thing, I have one field that I know must be 5-digits long, how can I write the code to ensure the user's entry is 5-digits?

Thanks in advance.

- Duane

"So I got that going for me, which is nice." - Carl Spackler

donburch
Starting Member

Australia
19 Posts

Posted - 11 December 2002 :  17:49:11  Show Profile  Visit donburch's Homepage
Hi Duane,
quote:
Originally posted by betheball

I have successfully made several fields in Register.asp be required fields. However, I read a comment by FrutZle in another post where he says that changing Register.asp won't prevent people from deleting the information when updating the profile. So, my question is, what other changes do I need to make so the fields are also required when updating a profile. Is it in pop_profile.asp? Here is the code I pasted into Register.asp:

If Trim(Request.Form("Firstname")) = "" then
Err_Msg = Err_Msg & "<li> You must enter a valid first name.</li>"
end if


Can I paste this same code into pop_profile.asp or whatever page I need to edit? If so, where should I paste it?
Correct.

I made a MOD to the ServerHacker version to do this (at http://www.serverhacker.com/forum/topic.asp?TOPIC_ID=987&).

You will need to change these program files:
- inc_profile.asp - display the form
- register.asp - server-side editing of the submitted new registrations form
- pop_profile.asp - server-side editing of the submitted member profile form


quote:
One last thing, I have one field that I know must be 5-digits long, how can I write the code to ensure the user's entry is 5-digits?

Since all data is received in Request.Form as strings, you will need to check both the length of the string, and that it has a numeric value... something like ...
strTemp = Trim(Request.Form("Firstname"))
If len(strTemp) = 5 then
    for i = 1 to 5
        If mid(strTemp,i) < "0" or mid(strTemp,i) > "9" then
            Err_Msg = Err_Msg & "<li> Fieldname must be 5 digits.</li>"
        end if
    next i
else
    Err_Msg = Err_Msg & "<li> Fieldname must be 5 digits.</li>"
end if


Cheers, Don.

P.S. When putting script in a forum post, I suggest you use the Snitz forum codes [ code ] and [ /code ] (without the extra spaces} to preserve your indentation and make the code easier to read.


Edited by - donburch on 11 December 2002 18:09:07
Go to Top of Page

betheball
Starting Member

USA
41 Posts

Posted - 11 December 2002 :  18:19:12  Show Profile
Thanks Don. In pop_profile.asp, I just pasted my code under the same piece of code under which I pasted in Register.asp. Worked great. I didn't change anything in.

As for my other question, I was probably a little misleading. When I said 5 digits, I meant 5 characters (alpha or numeric). The code below seems to do the job.

If Len(Request.Form("FIELD")) <> 5 then
Err_Msg = Err_Msg & "<li> Your entry must be exactly 5 characters in length.</li>"
end if


This is probably ASP 101 for you experienced people, but for me who has never had any formal training, it was a proud moment.

I have learned more about ASP in the few weeks since I have downloaded this product than I had in two years of designing web pages via FrontPage. Kudos to the developers of the SNITZ forum application. Besides being a great tool for exchanging information, it is a great learning tool for those novice progammers like myself.

- Duane

"So I got that going for me, which is nice." - Carl Spackler

Edited by - betheball on 11 December 2002 22:29:23
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.33 seconds. Powered By: Snitz Forums 2000 Version 3.4.07