Author |
Topic  |
Lydecker
Junior Member
 
United Kingdom
297 Posts |
Posted - 20 August 2002 : 16:13:27
|
If I wish to place default values in the registration fields (e.g - Username) - which page do I add the values to?
I can't seem to find it on the register.asp page, thereofore it must be on one of the included pages...
Thanks |
|
Roland
Advanced Member
    
Netherlands
9335 Posts |
Posted - 20 August 2002 : 16:17:02
|
inc_profile.asp
It's a bit more complex than it was for 3.3.x so be careful and test it before you put it live  |
 |
|
Lydecker
Junior Member
 
United Kingdom
297 Posts |
Posted - 20 August 2002 : 16:28:32
|
Boy you wern't kidding 
FrutZle, could you give me an example on how I would modify the code to make the default value for the Username appear as 'Jim'.
Thanks for you time. |
 |
|
Lydecker
Junior Member
 
United Kingdom
297 Posts |
Posted - 23 August 2002 : 11:32:56
|
Anyone 
THanks |
 |
|
Roland
Advanced Member
    
Netherlands
9335 Posts |
Posted - 23 August 2002 : 12:09:34
|
look for if strMode = "Register" then and add the text you want in the textbox by default as value=""yourtext"" where you replace yourtext with the text you want in the textbox.
You will want to add the text you put in the username field to be in the "username filter" to prevent anyone from using it as their username though Also, checking for those default values on register.asp (that's used when the form is submitted) and then giving an error when the field contains the default value when it's a required field (for example the email field), or not writing the info into the database if it's not a required field (for example the "bio" or "signature" fields), would be a good idea. |
 |
|
Lydecker
Junior Member
 
United Kingdom
297 Posts |
Posted - 24 August 2002 : 14:53:58
|
Okay - so I am trying to place a default value in the password field. THis value is to be requested from a cookie. Currently I have used the following code:
quote: <input name=""Password"" size=""25"" maxLength=""25"" value=""&Request.cookies('Spooky')('T2aPd')"">
But this seems to display the value quote: Request.cookies('Spooky')('T2aPd')
when the page is loaded. How do I make it read it as .asp code? so it actually displays the password from the cookie?
Thanks! |
 |
|
Roland
Advanced Member
    
Netherlands
9335 Posts |
Posted - 24 August 2002 : 14:56:51
|
you need to make it value=""" & Request.Cookies("Spooky")("T2aPd") & """> |
 |
|
Lydecker
Junior Member
 
United Kingdom
297 Posts |
Posted - 24 August 2002 : 16:59:25
|
Okay almost there now - promise 
I have my default fields working with cookies for the two password fields, and the second email. The first email .asp code is different though. How do I add a default email address to this code:
quote: <input name=""Email"" size=""25"" maxLength=""50"" value=""" if strMode <> "Register" then Response.Write(ChkString(rs("M_EMAIL"), "display")) Response.Write """>" & vbNewLine & _
Many thanks for all this |
 |
|
Roland
Advanced Member
    
Netherlands
9335 Posts |
Posted - 24 August 2002 : 17:33:40
|
<input name=""Email"" size=""25"" maxLength=""50"" if strMode <> "Register" then Response.Write " value=""" & ChkString(rs("M_EMAIL"), "display")) & """>" & vbNewline else Response.Write ">" & vbNewLine end if
This inserts the default value when you're not registering. You can add the value part with a default text in the second Response.Write if you want a default value when someone is registering. |
 |
|
Lydecker
Junior Member
 
United Kingdom
297 Posts |
Posted - 24 August 2002 : 18:09:40
|
quote: vbNewline else Response.Write ">" & vbNewLine end if
This is getting a tad confusing, because I cant actually find this code (the 2nd response.write) you show above.... Please could you give me the whole email section code chunk, and highlight where I bung the value tag in.
many thanks |
 |
|
Roland
Advanced Member
    
Netherlands
9335 Posts |
Posted - 24 August 2002 : 18:26:15
|
I modified the code you posted and added a second Response.Write  |
 |
|
Lydecker
Junior Member
 
United Kingdom
297 Posts |
Posted - 24 August 2002 : 18:42:21
|
quote: Originally posted by FrutZle
I modified the code you posted and added a second Response.Write 
I can't see any modification on the code I posted 
(really sorry about this!) |
 |
|
Roland
Advanced Member
    
Netherlands
9335 Posts |
Posted - 24 August 2002 : 18:49:32
|
Compare:
<input name=""Email"" size=""25"" maxLength=""50"" value=""" if strMode <> "Register" then Response.Write(ChkString(rs("M_EMAIL"), "display")) Response.Write """>" & vbNewLine & _
vs.
<input name=""Email"" size=""25"" maxLength=""50"" if strMode <> "Register" then Response.Write " value=""" & ChkString(rs("M_EMAIL"), "display")) & """>" & vbNewline else Response.Write ">" & vbNewLine end if
I see quite a difference. For example, you can now easily add a default value when someone registers by adding value=""something"" to the line in red which you didn't have in the original code. Secondly, it looks more readable  |
 |
|
Lydecker
Junior Member
 
United Kingdom
297 Posts |
Posted - 25 August 2002 : 07:48:17
|
Here is my current email code: quote: <input name=""Email"" size=""25"" maxLength=""50"" if strMode <> "Register" then Response.Write " value=""" & ChkString(rs("M_EMAIL"), "display")) & """>" & vbNewline else Response.Write ">" & vbNewLine end if
But with this I seem to get a Unterminated string constant error:
/buffy/forum/inc_profile.asp, line 72
" <td bgColor=""" & strPopUpTableColor & """><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><input name=""Email"" size=""25"" maxLength=""50"" --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------^
|
 |
|
Roland
Advanced Member
    
Netherlands
9335 Posts |
Posted - 25 August 2002 : 10:08:21
|
well you only showed me a part of your code. Try adding " to the end of the first line (the one ending with maxlength=""50"") |
 |
|
Lydecker
Junior Member
 
United Kingdom
297 Posts |
Posted - 25 August 2002 : 11:20:21
|
I thought I did show you all of the code (I haven't added the default value yet, just trying to rid the errors first!). Anyways, my errors seem to be going round in circles, any chance I could send you the inc_profile.asp page for you to take a peek at If you have the time to do this that would be great, many thanks |
 |
|
Topic  |
|