Solved

Radio Buttons records wrong input in Access Database

Posted on 2004-08-25
5
129 Views
Last Modified: 2010-04-25

Hello,

I have an ongoing problem with a form made in DW which inserts the wrong input into Access database.

I have an open question here:
http://www.experts-exchange.com/Web/Web_Languages/ASP/Q_21106199.html

And getting really desprate. I thought maybe in the DW section i have better luck.

0
Comment
Question by:polaatx
  • 3
  • 2
5 Comments
 
LVL 8

Accepted Solution

by:
alexhogan earned 500 total points
ID: 11899163
Try this;

<input name="publicTransportation" type="radio" value="-1">
Yes
<input name="publicTransportation" type="radio" value="0">
No</p>

Access is a little weird in that on a Yes/No field -1 equates to a True or Yes state while 0 equates to a False or No state.

This isn't really that uncommon in structured languages where 0 is False and anything not 0 is True even a -1.  This should not however be related to a NULL value.  A 0 is not a NULL value but a 0 value.  So any check for IsNull on a field with a 0 value will render False.
0
 

Author Comment

by:polaatx
ID: 11899263
Hi alexhogan,

I've tried the -1 ,0 combination.

I built this form: http://www.aurafellows.net/aura/testForm_insert.asp 
which insert into a yes/no Access field.

No matter what combination I use (yes/no, -1/0, 1/0, true/false) the input into database is ALWAYS either true or false.

I have search Dreamweaver's forum and support site to no avail.

Here's my html:

<form name="form1" action="<%=MM_editAction%>" method="POST">
<p>Do you have transportation to another institution?
&nbsp;&nbsp;
<input name="publicTransportation" type="radio" value="-1">
Yes  
<input name="publicTransportation" type="radio" value="0">
No
</p>
<p><input name="submit" type="submit">
<input type="hidden" name="MM_insert" value="form1">
</form>

And here's the insert statement:



If (CStr(Request("MM_insert")) = "form1") Then

  MM_editConnection = MM_connTest_STRING
  MM_editTable = "CheckboxTest"
  MM_editRedirectUrl = "testForm_insert.asp"
  MM_fieldsStr  = "publicTransportation|value"
  MM_columnsStr = "publicTransport|none,-1,0"

  ' create the MM_fields and MM_columns arrays
  MM_fields = Split(MM_fieldsStr, "|")
  MM_columns = Split(MM_columnsStr, "|")
 
  ' set the form values
  For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
    MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
  Next

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

End If
%>
<%
' *** Insert Record: construct a sql insert statement and execute it

Dim MM_tableValues
Dim MM_dbValues

If (CStr(Request("MM_insert")) <> "") Then

  ' create the sql insert statement
  MM_tableValues = ""
  MM_dbValues = ""
  For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
    MM_formVal = MM_fields(MM_i+1)
    MM_typeArray = Split(MM_columns(MM_i+1),",")
    MM_delim = MM_typeArray(0)
    If (MM_delim = "none") Then MM_delim = ""
    MM_altVal = MM_typeArray(1)
    If (MM_altVal = "none") Then MM_altVal = ""
    MM_emptyVal = MM_typeArray(2)
    If (MM_emptyVal = "none") Then MM_emptyVal = ""
    If (MM_formVal = "") Then
      MM_formVal = MM_emptyVal
    Else
      If (MM_altVal <> "") Then
        MM_formVal = MM_altVal
      ElseIf (MM_delim = "'") Then  ' escape quotes
        MM_formVal = "'" & Replace(MM_formVal,"'","''") & "'"
      Else
        MM_formVal = MM_delim + MM_formVal + MM_delim
      End If
    End If
    If (MM_i <> LBound(MM_fields)) Then
      MM_tableValues = MM_tableValues & ","
      MM_dbValues = MM_dbValues & ","
    End If
    MM_tableValues = MM_tableValues & MM_columns(MM_i)
    MM_dbValues = MM_dbValues & MM_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 <> "") Then
      Response.Redirect(MM_editRedirectUrl)
    End If
  End If

End If
%>
0
 

Author Comment

by:polaatx
ID: 11908151
Anyone with ideas on how to troubleshoot this?

I left messages on DW forum and elsewhere and nothing! Not even similar problem on Google Groups.
0
 

Author Comment

by:polaatx
ID: 11924421
I found the answer to this problem on the DW forum on Macromedia site.

Turns out for radio buttons, in DW one has to have the insert dialog submit the data as TEXT.

What is the procedure for closing a question if I found my answer elsewhere?
0
 
LVL 8

Expert Comment

by:alexhogan
ID: 11924551
Go to the support area and request that the question be closed and points refunded.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Find & replace in Dreamweaver code to: add +1 to many id's 3 260
Multi Step Form using jQuery 11 937
Editing PHP within Adobe DreamWeaver 11 183
CF Buider 2 connect to remote server 6 73
For those who don't know, Adobe Dreamweaver is a popular commercial web editor that enables you to design, build and manage complex websites. The editor is a WYSIWYG (What You See Is What You Get) web editor, which means that you can create your web…
I still run into .cgi files every now and then. In some instances, I actually prefer the simplicity of a .cgi script to other options. Since I use DreamWeaver extensively, what I needed was a way to open .cgi scripts in Dreamweaver. And I wanted to …
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now