Universal Form Validator ASP Support Product Page

Problem for exists in database

Reported 18 Dec 2009 13:12:47
1
has this problem
18 Dec 2009 13:12:47 Paul Ogier posted:
I am trying to insert this but the field company_guid needs to be unique in the database, i have tried on a normal page and now below you will see the simple page i tried on. It will not insert even if it doesn't have a conflict.

Please help.

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="Connections/conn_admin1.asp" -->
<!--#include file="ScriptLibrary/dmxValidator.asp" -->
<
%Dim MM_editAction
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
  MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If

' boolean to abort record edit
Dim MM_abortEdit
MM_abortEdit = false
%>
<
%' Universal Form Validator ASP 1.5.1
dim dmxval1, DMX_validateAction
set dmxval1 = new dmxValidator
dmxval1.ScriptFolder = "ScriptLibrary"
dmxval1.CSValidateOnChange = true
dmxval1.CSValidateOnSubmit = true
dmxval1.UseBotCheck = true
dmxval1.ReportType = 4
dmxval1.ErrorFont =  "Arial"
dmxval1.ErrorFontSize = 12
dmxval1.ErrorColor = "#ffffff"
dmxval1.ErrorBold = true
dmxval1.ErrorItalic = false
dmxval1.ErrorImage = ""
dmxval1.ErrorFixed = "Custom"
dmxval1.ErrorPadding = 4
dmxval1.BorderColor = "#FF0000"
dmxval1.CssErrorFile = "validatorError1"
dmxval1.ErrorPreset = "error_five.txt"
dmxval1.TooltipPosition = "top"
dmxval1.CssHintFile = "validatorHint1"
dmxval1.HintPreset = "blue.txt"
dmxval1.HintTooltipPosition = "top"
dmxval1.HintBorderColor = "#0099ff"
dmxval1.HintBorderStyle = "solid"
dmxval1.HintBgColor = "#003399"
dmxval1.HintTextColor = "#ffffff"
dmxval1.HintTextFont = "Arial"
dmxval1.HintTextSize = 12
dmxval1.HintTextBold = false
dmxval1.HintTextItalic = false
dmxval1.HintBoxWidth = 200
dmxval1.HintImage = ""
dmxval1.HintFixed = "Custom"
dmxval1.HintPadding = 4
dmxval1.UseCustomFocusClass = "fixed"
dmxval1.FocusBorderStyle = "solid"
dmxval1.FocusBorderSize = 1
dmxval1.FocusBorderColor = "#C3D9FF"
dmxval1.FocusBgColor = "#FFFFFF"
dmxval1.FocusTextColor = "#000000"
dmxval1.UseCustomValidClass = "fixed"
dmxval1.ValidBorderStyle = "solid"
dmxval1.ValidBorderSize = 1
dmxval1.ValidBorderColor = "#00FF00"
dmxval1.ValidBgColor = "#FFFFFF"
dmxval1.ValidTextColor = "#000000"
dmxval1.UseCustomInvalidClass = "fixed"
dmxval1.InvalidBorderStyle = "solid"
dmxval1.InvalidBorderSize = 2
dmxval1.InvalidBorderColor = "#FF0000"
dmxval1.InvalidBgColor = "#FFFFFF"
dmxval1.InvalidTextColor = "#000000"
dmxval1.AddRule "form1", "company_guid", "ajaxexistscond", "validatorAjax/dmxValidatorAjax9.asp,,", "true", "", "", "", ""
dmxval1.Validate
%>
<
%If (CStr(Request("MM_insert")) = "form1") Then
  If (Not MM_abortEdit) Then
    ' execute the insert
    Dim MM_editCmd

    Set MM_editCmd = Server.CreateObject ("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_conn_admin1_STRING
    MM_editCmd.CommandText = "INSERT INTO Companies (company_name, company_guid) VALUES (?, ?)" 
    MM_editCmd.Prepared = true
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 202, 1, 255, Request.Form("company_name")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 202, 1, 255, Request.Form("company_guid")) ' adVarWChar
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close
  End If
End If
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link rel="stylesheet" href="Styles/dmxValidator/validatorHint1.css" type="text/css" />
<link rel="stylesheet" href="Styles/dmxValidator/validatorError1.css" type="text/css" />
<script src="ScriptLibrary/jsvat.js" type="text/javascript"></script>
<script src="ScriptLibrary/jquery-latest.pack.js" type="text/javascript"></script>
<script src="ScriptLibrary/jquery.inputHintBox.js" type="text/javascript"></script>
<script src="ScriptLibrary/jquery.maskedinput-1.2.2.js" type="text/javascript"></script>
<script src="ScriptLibrary/jquery.validate.min.js" type="text/javascript"></script>
<script src="ScriptLibrary/dmx.jquery.validate.js" type="text/javascript"></script>
<script src="ScriptLibrary/jquery.tooltip.min.js" type="text/javascript"></script>
<script src="ScriptLibrary/jquery.hoverIntent.min.js" type="text/javascript"></script>
<% 
' dmxValidatorJSStart
dmxval1.GenerateJavascriptAndCss
' dmxValidatorJSEnd
%>
</head>

<body>
<form action="<%=MM_editAction%>" method="post" name="form1" id="form1">
  <table align="center">
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Company_name:</td>
      <td><input type="text" name="company_name" value="<%= dmxSetValue("", FormRequest("company_name")) %>" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Company_guid:</td>
      <td><input type="text" name="company_guid" value="<%= dmxSetValue("", FormRequest("company_guid")) %>" size="32" />
      <% dmxval1.GenerateError "form1","company_guid","ajaxexistscond","validatorAjax/dmxValidatorAjax9.asp,," %></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">&nbsp;</td>
      <td><input type="submit" value="Insert record" /></td>
    </tr>
  </table>
  <input type="hidden" name="MM_insert" value="form1" />
  <% dmxval1.ShowBotCheckError() %>
</form>
<p>&nbsp;</p>
</body>
</html>

Replies

Replied 31 Jan 2010 13:49:43
31 Jan 2010 13:49:43 Paul Ogier replied:
Any news on this question?

Reply to this topic