Forums

This topic is locked

list menu in register page.

Posted 13 Feb 2002 22:02:28
1
has voted
13 Feb 2002 22:02:28 Serge Chabert posted:
hello guys, i am working on a resgistering page. i hava a Access database with one table with several fields : first name, last name, etc...
For the field Profession and City, i would like the person to fill the field by choosing from a list menu. How can i achieve that in Ultradev. I know that i have to work with the list values in the property panel. but i really don't know how to do it. Can anybody help me.

Replies

Replied 14 Feb 2002 15:24:43
14 Feb 2002 15:24:43 Dennis van Galen replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
hello guys, i am working on a resgistering page. i hava a Access database with one table with several fields : first name, last name, etc...
For the field Profession and City, i would like the person to fill the field by choosing from a list menu. How can i achieve that in Ultradev. I know that i have to work with the list values in the property panel. but i really don't know how to do it. Can anybody help me.
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

Hello again,

I would make 2 dbase tables, one for professions and one for cities or countries, give each table 2 fields: 1 with name and 1 uniqueID.
In the page we make 2 queries, 1 for professions say rsJobs and 1 for cities say rsHometown.
Then we drop the menu inside the &lt;form&gt; tag and go to the property panel after selecting the menu/list.

We click on list values in the property panel and we click on the Lightning Bolt, we then show our query fields by clicking the small + icon besides the rsJobs query, and we click on names for the labels and we then set the value to the uniqueID and that's basically it.

The resulting code for the dynamic menu should resemble something like this:

&lt;select name="Jobs"&gt;
&lt;%
while (!rsJobs.EOF) {
%&gt;
&lt;option value="&lt;%=(rsJobs.Fields.Item("UniqueJobsID".Value)%&gt;" &lt;%=((rsJobs.Fields.Item("UniqueJobsID".Value == rsAllUsers.Fields.Item("UniqueJobsID".Value)?"SELECTED":""%&gt; &gt;&lt;%=(rsJobs.Fields.Item("JobsName".Value)%&gt;&lt;/option&gt;
&lt;%
rsJobs.MoveNext();
}
if (rsJobs.CursorType &gt; 0) {
if (!rsJobs.BOF) rsJobs.MoveFirst();
} else {
rsJobs.Requery();
}
%&gt;
&lt;/select&gt;

That should do the trick, note that rsAllUsers is my query for the User that is currently being modified.
Repeat this procedure to make a menu/list that draws it's labels and values from the other Dbase table and it should work like a charm.

Do let me know if this still gives you headaches.

With kind regards,

Dennis van Galen
Webmaster KPN Nederland
Financial and Information Services
Replied 14 Feb 2002 21:13:17
14 Feb 2002 21:13:17 Serge Chabert replied:
Hello again,

I have just discovered something, so allow me to explain. i have created a registering page with text field for every section. And then i have created a registersuccess page where every new member can see his username, password and first name after his registration. So it works well wen all the field the user enter on the registration page are textfield.
Now if i replace a text field by a list/menu with several item to choose, here is that appears on the registersuccess page :

Congratulation,

Microsoft VBScript compilation error '800a0401'

Expected end of statement

/iisHelp/common/500-100.asp, line 11

Dim objASPError, blnErrorWritten, strServername, strServerIP, strRemoteIP Dim strMethod, lngPos, datNow, strQueryString, strURL
--------------------------------------------------------------------------^
ADODB.Field error '800a0bcd'

BOF ou EOF est égal à True ou l'enregistrement actuel a été supprimé. L'opération demandée nécessite un enregistrement actuel.

/registersucces.asp, line 24

But the strangest thing of all is that the database is updated. So could it be possible that the problem comes from the registersucces page ?


Replied 14 Feb 2002 21:15:46
14 Feb 2002 21:15:46 Serge Chabert replied:
HERE IS THE CODE ON THE register.asp PAGE :

&lt;%@LANGUAGE="VBSCRIPT"%&gt;
&lt;!--#include file="Connections/serge.asp" --&gt;
&lt;%
' *** Edit Operations: declare variables

MM_editAction = CStr(Request("URL")
If (Request.QueryString &lt;&gt; "" Then
MM_editAction = MM_editAction & "?" & Request.QueryString
End If

' boolean to abort record edit
MM_abortEdit = false

' query string to execute
MM_editQuery = ""
%&gt;
&lt;%
' *** Insert Record: set variables

If (CStr(Request("MM_insert") &lt;&gt; "" Then

MM_editConnection = MM_serge_STRING
MM_editTable = "users"
MM_editRedirectUrl = "registersucces.asp"
MM_fieldsStr = "Firstname|value|Lastname|value|Username|value|Password|value|Email|value|Phone|value|Address|value|Zipcode|value|City|value|State|value|Country|value|Profession|value|Website|value|comments|value"
MM_columnsStr = "Firstname|',none,''|Lastname|',none,''|Username|',none,''|Password|',none,''|Email|',none,''|Phone|',none,''|Address|',none,''|Zipcode|',none,''|City|',none,''|State|',none,''|Country|',none,''|Profession|',none,''|Website|',none,''|comments|',none,''"

' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|"
MM_columns = Split(MM_columnsStr, "|"

' set the form values
For i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(i+1) = CStr(Request.Form(MM_fields(i)))
Next

' append the query string to the redirect URL
If (MM_editRedirectUrl &lt;&gt; "" And Request.QueryString &lt;&gt; "" Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString &lt;&gt; "" Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If

End If
%&gt;
&lt;%
' *** Insert Record: construct a sql insert statement and execute it

If (CStr(Request("MM_insert") &lt;&gt; "" Then

' create the sql insert statement
MM_tableValues = ""
MM_dbValues = ""
For i = LBound(MM_fields) To UBound(MM_fields) Step 2
FormVal = MM_fields(i+1)
MM_typeArray = Split(MM_columns(i+1),","
Delim = MM_typeArray(0)
If (Delim = "none" Then Delim = ""
AltVal = MM_typeArray(1)
If (AltVal = "none" Then AltVal = ""
EmptyVal = MM_typeArray(2)
If (EmptyVal = "none" Then EmptyVal = ""
If (FormVal = "" Then
FormVal = EmptyVal
Else
If (AltVal &lt;&gt; "" Then
FormVal = AltVal
ElseIf (Delim = "'" Then ' escape quotes
FormVal = "'" & Replace(FormVal,"'","''" & "'"
Else
FormVal = Delim + FormVal + Delim
End If
End If
If (i &lt;&gt; LBound(MM_fields)) Then
MM_tableValues = MM_tableValues & ","
MM_dbValues = MM_dbValues & ","
End if
MM_tableValues = MM_tableValues & MM_columns(i)
MM_dbValues = MM_dbValues & FormVal
Next
MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & " values (" & MM_dbValues & ""

If (Not MM_abortEdit) Then
' execute the insert
Set MM_editCmd = Server.CreateObject("ADODB.Command"
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close

If (MM_editRedirectUrl &lt;&gt; "" Then
Response.Redirect(MM_editRedirectUrl)
End If
End If

End If
%&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Untitled Document&lt;/title&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt;
&lt;/head&gt;
&lt;body bgcolor="#FFFFFF" text="#000000"&gt;
&lt;table width="58%"&gt;
&lt;tr&gt;
&lt;td&gt;&nbsp;
&lt;form method="POST" action="&lt;%=MM_editAction%&gt;" name="form1"&gt;
&lt;table align="center"&gt;
&lt;tr valign="baseline"&gt;
&lt;td nowrap align="right"&gt;Firstname:&lt;/td&gt;
&lt;td&gt;
&lt;input type="text" name="Firstname" value="" size="32"&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr valign="baseline"&gt;
&lt;td nowrap align="right"&gt;Lastname:&lt;/td&gt;
&lt;td&gt;
&lt;input type="text" name="Lastname" value="" size="32"&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr valign="baseline"&gt;
&lt;td nowrap align="right"&gt;Username:&lt;/td&gt;
&lt;td&gt;
&lt;input type="text" name="Username" value="" size="32"&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr valign="baseline"&gt;
&lt;td nowrap align="right"&gt;Password:&lt;/td&gt;
&lt;td&gt;
&lt;input type="text" name="Password" value="" size="32"&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr valign="baseline"&gt;
&lt;td nowrap align="right"&gt;Email:&lt;/td&gt;
&lt;td&gt;
&lt;input type="text" name="Email" value="" size="32"&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr valign="baseline"&gt;
&lt;td nowrap align="right"&gt;Phone:&lt;/td&gt;
&lt;td&gt;
&lt;input type="text" name="Phone" value="" size="32"&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr valign="baseline"&gt;
&lt;td nowrap align="right"&gt;Address:&lt;/td&gt;
&lt;td&gt;
&lt;input type="text" name="Address" value="" size="32"&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr valign="baseline"&gt;
&lt;td nowrap align="right"&gt;Zipcode:&lt;/td&gt;
&lt;td&gt;
&lt;input type="text" name="Zipcode" value="" size="32"&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr valign="baseline"&gt;
&lt;td nowrap align="right"&gt;City:&lt;/td&gt;
&lt;td&gt;
&lt;select name="City"&gt;
&lt;option value="New York" selected&gt;New York&lt;/option&gt;
&lt;option value="Miami"&gt;Miami&lt;/option&gt;
&lt;option value="Los Angeles"&gt;Los Angeles&lt;/option&gt;
&lt;option value="London"&gt;London&lt;/option&gt;
&lt;option value="Glasgow"&gt;Glasgow&lt;/option&gt;
&lt;option value="Greenock"&gt;Greenock&lt;/option&gt;
&lt;option value="Paris"&gt;Paris&lt;/option&gt;
&lt;option value="Milan"&gt;Milan&lt;/option&gt;
&lt;option value="Barcelona"&gt;Barcelona&lt;/option&gt;
&lt;/select&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr valign="baseline"&gt;
&lt;td nowrap align="right"&gt;State:&lt;/td&gt;
&lt;td&gt;
&lt;input type="text" name="State" value="" size="32"&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr valign="baseline"&gt;
&lt;td nowrap align="right"&gt;Country:&lt;/td&gt;
&lt;td&gt;
&lt;input type="text" name="Country" value="" size="32"&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr valign="baseline"&gt;
&lt;td nowrap align="right"&gt;Profession:&lt;/td&gt;
&lt;td&gt;
&lt;select name="Profession"&gt;
&lt;option value="photographer" selected&gt;photographer&lt;/option&gt;
&lt;option value="make-up artist"&gt;make-up artist&lt;/option&gt;
&lt;option value="hair stylist"&gt;hair stylist&lt;/option&gt;
&lt;option value="stylist"&gt;stylist&lt;/option&gt;
&lt;/select&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr valign="baseline"&gt;
&lt;td nowrap align="right"&gt;Website:&lt;/td&gt;
&lt;td&gt;
&lt;input type="text" name="Website" value="" size="32"&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr valign="baseline"&gt;
&lt;td nowrap align="right"&gt;Comments:&lt;/td&gt;
&lt;td&gt;
&lt;input type="text" name="comments" value="" size="32"&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr valign="baseline"&gt;
&lt;td nowrap align="right"&gt;&nbsp;&lt;/td&gt;
&lt;td&gt;
&lt;input type="submit" value="Insert Record"&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;input type="hidden" name="MM_insert" value="true"&gt;
&lt;/form&gt;
&lt;p&gt;&nbsp;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/body&gt;
&lt;/html&gt;



Replied 14 Feb 2002 21:17:49
14 Feb 2002 21:17:49 Serge Chabert replied:
AND HERE IS THE CODE ON MY registersuccess.asp PAGE :

&lt;%@LANGUAGE="VBSCRIPT"%&gt;
&lt;!--#include file="Connections/serge.asp" --&gt;
&lt;%
Dim RssubmitConfirm__strUsername
RssubmitConfirm__strUsername = "xyz"
if (Session("svUsername" &lt;&gt; "" then RssubmitConfirm__strUsername = Session("svUsername"
%&gt;
&lt;%
set RssubmitConfirm = Server.CreateObject("ADODB.Recordset"
RssubmitConfirm.ActiveConnection = MM_serge_STRING
RssubmitConfirm.Source = "SELECT * FROM users WHERE Username = '" + Replace(RssubmitConfirm__strUsername, "'", "''" + "'"
RssubmitConfirm.CursorType = 0
RssubmitConfirm.CursorLocation = 2
RssubmitConfirm.LockType = 3
RssubmitConfirm.Open()
RssubmitConfirm_numRows = 0
%&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Untitled Document&lt;/title&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt;
&lt;/head&gt;
&lt;body bgcolor="#FFFFFF" text="#000000"&gt;
&lt;p&gt;Congratulation, &lt;%=(RssubmitConfirm.Fields.Item("Firstname".Value)%&gt; &lt;font color="#FFFFFF"&gt;.&lt;/font&gt;&lt;%=(RssubmitConfirm.Fields.Item("Lastname".Value)%&gt; you have registered successfully !!!! &lt;/p&gt;
&lt;p&gt;Your Username is &lt;%=(RssubmitConfirm.Fields.Item("Username".Value)%&gt;&lt;br&gt;
Your Password is &lt;%=(RssubmitConfirm.Fields.Item("Password".Value)%&gt;&lt;/p&gt;
&lt;p&gt;You are now a registered member.&lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;
&lt;%
RssubmitConfirm.Close()
%&gt;


Any Idea ?

Replied 14 Feb 2002 22:56:30
14 Feb 2002 22:56:30 Dennis van Galen replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Hello again,

I have just discovered something, so allow me to explain. i have created a registering page with text field for every section. And then i have created a registersuccess page where every new member can see his username, password and first name after his registration. So it works well wen all the field the user enter on the registration page are textfield.
Now if i replace a text field by a list/menu with several item to choose, here is that appears on the registersuccess page :

Congratulation,

Microsoft VBScript compilation error '800a0401'

Expected end of statement

/iisHelp/common/500-100.asp, line 11

Dim objASPError, blnErrorWritten, strServername, strServerIP, strRemoteIP Dim strMethod, lngPos, datNow, strQueryString, strURL
--------------------------------------------------------------------------^
ADODB.Field error '800a0bcd'

BOF ou EOF est égal à True ou l'enregistrement actuel a été supprimé. L'opération demandée nécessite un enregistrement actuel.

/registersucces.asp, line 24

But the strangest thing of all is that the database is updated. So could it be possible that the problem comes from the registersucces page ?
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

Ok, before I reply you must know that my french is really lousy and my knowledge of VB-script is only a tad better. The form code I quoted earlier was in java-script, but it's a form element so the only trouble it should give would be the dynamic part of it, but if you use the standard server-behaviour there should be no problem in the way I described how to add a dynamic menu.

Now that that's out of the way...
I think the error is in the way you select the username from the database.
I've looked at the success code and the error comes right after the congratulations and before the printing of the user's name.
The BOF EOF error is usually a result of a empty selection which you try to display, ending in the error because the server cannot display an empty record.

As to how to solve this, I haven't got a clue.
My knowledge of VB simply is insufficient to precisely determine what is wrong in the way you query the database...

RssubmitConfirm.Source = "SELECT * FROM users WHERE Username = '" + Replace(RssubmitConfirm__strUsername, "'", "''" + "'"

WHERE Username = ' ?
I'm guessing it cannot find a user with the name ' and you try to replace it with the strUsername that is still in memory from the register page ?
I don't understand the precise error either, The operation demands a necessary actual registry ?

Can you turn the local errors off in your browser setting and show me the error in English, maybe then it will make sense.

And maybe someone with a bit more VB knowledge who reads this can figure out what's wrong, i'm pretty sure that what i said is wrong.

Nonetheless, i'll try to help as best as I can.

With kind regards,

Dennis van Galen
Webmaster KPN Nederland
Financial and Information Services
Replied 15 Feb 2002 08:50:31
15 Feb 2002 08:50:31 Serge Chabert replied:
hi, sorry this may be a stupid question but how can i turn the local errors off on my browser ?

Replied 15 Feb 2002 08:50:40
15 Feb 2002 08:50:40 Serge Chabert replied:
hi, sorry this may be a stupid question but how can i turn the local errors off on my browser ?

Replied 15 Feb 2002 09:05:59
15 Feb 2002 09:05:59 Serge Chabert replied:
hi again,
i have looked at the line where you told me there was something missing and i think the missing thing is 'strUsername' as followed.

RssubmitConfirm.Source = "SELECT * FROM users WHERE Username = 'strUsername' + Replace(RssubmitConfirm__strUsername, "'", "''" + "'"


What do you think ? am on the right track ?


Replied 15 Feb 2002 09:07:54
15 Feb 2002 09:07:54 Dennis van Galen replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
hi, sorry this may be a stupid question but how can i turn the local errors off on my browser ?
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

In Micro$oft explorer goto the extra menu, then go to internet options, there you click on the advanced tab-screen and you scroll down to the Surfing part and there is a setting called "Display userfriendly HTTP-error messages", we want to uncheck that setting.

This should set explorer to default back to english error messages.

With kind regards,

Dennis van Galen
Webmaster KPN Nederland
Financial and Information Services
Replied 15 Feb 2002 13:56:09
15 Feb 2002 13:56:09 Dennis van Galen replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
hi again,
i have looked at the line where you told me there was something missing and i think the missing thing is 'strUsername' as followed.

RssubmitConfirm.Source = "SELECT * FROM users WHERE Username = 'strUsername' + Replace(RssubmitConfirm__strUsername, "'", "''" + "'"

What do you think ? am on the right track ?
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
It looks as if that would work, have you tried that ?

With kind regards,

Dennis van Galen
Webmaster KPN Nederland
Financial and Information Services
Replied 15 Feb 2002 14:16:37
15 Feb 2002 14:16:37 Serge Chabert replied:
hi again,

no unfortnately i have not checked if if works. i will be able to do that tonight. thanks for the info.

i had a hunch and i just wanted to see if i was right.


thanks for you support <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

Replied 15 Feb 2002 14:18:39
15 Feb 2002 14:18:39 Serge Chabert replied:
hi again,

no unfortnately i have not checked if if works. i will be able to do that tonight. thanks for the info.

i had a hunch and i just wanted to see if i was right.


thanks for you support <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

Replied 15 Feb 2002 19:14:41
15 Feb 2002 19:14:41 Serge Chabert replied:
Hi,

i have just tried it and, unfortunately it does not work.

Here is the new error message :

Microsoft VBScript compilation error '800a0401'

Expected end of statement

/iisHelp/common/500-100.asp, line 11

Dim objASPError, blnErrorWritten, strServername, strServerIP, strRemoteIP Dim strMethod, lngPos, datNow, strQueryString, strURL
--------------------------------------------------------------------------^
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][Pilote ODBC Microsoft Access] Syntax error (missing operator) In the expression 'Username = 'strUsername'xyz''.

/registersucces.asp, line 15


Replied 18 Feb 2002 04:16:20
18 Feb 2002 04:16:20 b w replied:
Try not to include the second DIM unless in a different line.

I think it is looking for a comma but ran into a DIM.


<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Hi,

i have just tried it and, unfortunately it does not work.

Here is the new error message :

Microsoft VBScript compilation error '800a0401'

Expected end of statement

/iisHelp/common/500-100.asp, line 11

Dim objASPError, blnErrorWritten, strServername, strServerIP, strRemoteIP Dim strMethod, lngPos, datNow, strQueryString, strURL
--------------------------------------------------------------------------^
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][Pilote ODBC Microsoft Access] Syntax error (missing operator) In the expression 'Username = 'strUsername'xyz''.

/registersucces.asp, line 15



<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

Reply to this topic