close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

data assist costum error or success message

Thread began 2/27/2010 3:20 pm by randyw2394710 | Last modified 3/09/2010 9:13 pm by Dani Chankhour | 1787 views | 15 replies |

randyw2394710

data assist costum error or success message

I would like to have the insert page, check to see if there is allready a specials name before insert into data base. If it does exsists i would like to have a <div> tag appear with that name and say error duplicatate name on the insert page. If it does not exsists go to detail page with <div> tag apear with suuccess specials name has been added.

---------insert page----------------------------------
<?php
// WA Application Builder Insert
if (isset($_POST["Insert_x"])) // Trigger
{
$WA_connection = $BrowardLimo;
$WA_table = "specials";
$WA_sessionName = "WADA_Insert_specials";
$WA_redirectURL = "specials_Detail.php";
$WA_keepQueryString = false;
$WA_indexField = "id";
$WA_fieldNamesStr = "specialName|createdBy|updatedBy|email|removeOn|comment";
$WA_fieldValuesStr = "".((isset($_POST["specialName"]))?$_POST["specialName"]:"") ."" . "|" . "".((isset($_POST["createdBy"]))?$_POST["createdBy"]:"") ."" . "|" . "".((isset($_POST["updatedBy"]))?$_POST["updatedBy"]:"") ."" . "|" . "".((isset($_POST["email"]))?$_POST["email"]:"") ."" . "|" . "".((isset($_POST["removeOn"]))?$_POST["removeOn"]:"") ."" . "|" . "".((isset($_POST["comment"]))?$_POST["comment"]:"") ."";
$WA_columnTypesStr = "',none,''|',none,''|',none,''|',none,''|',none,''|',none,''";
$WA_fieldNames = explode("|", $WA_fieldNamesStr);
$WA_fieldValues = explode("|", $WA_fieldValuesStr);
$WA_columns = explode("|", $WA_columnTypesStr);
$WA_connectionDB = $database_BrowardLimo;
mysql_select_db($WA_connectionDB, $WA_connection);
if (!session_id()) session_start();
$insertParamsObj = WA_AB_generateInsertParams($WA_fieldNames, $WA_columns, $WA_fieldValues, -1);
$WA_Sql = "INSERT INTO `" . $WA_table . "` (" . $insertParamsObj->WA_tableValues . ") VALUES (" . $insertParamsObj->WA_dbValues . ")";
$MM_editCmd = mysql_query($WA_Sql, $WA_connection) or die(mysql_error());
$_SESSION[$WA_sessionName] = mysql_insert_id();
if ($WA_redirectURL != "") {
if ($WA_keepQueryString && $WA_redirectURL != "" && isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] !== "" && sizeof($_POST) > 0) {
$WA_redirectURL .= ((strpos($WA_redirectURL, '?') === false)?"?":"&").$_SERVER["QUERY_STRING"];
}
header("Location: ".$WA_redirectURL);
}
}
?>

Sign in to reply to this post

Dani Chankhour

here are the steps:

1. create a record set that filters based on the post value, in your case it is probably the email.
2. then use the Dreamweaver Show Region Server behavior to show the div if the record set is not empty

3. then surround the DataAssist server behavior with the opposite logic, so you wanted if the record set is empty to run the datassist server behavior.

let me know if you have any additional questions.

Sign in to reply to this post

randyw2394710

fromcapabler

hey there is there any tutorial to do this its little confusing but looks close i will try it

Sign in to reply to this post

Dani Chankhour

We don't have a tutorial on how to do this, but we can take it one step at a time.

First, try just creating a record set that pulls everything from your special table. Then in the same interface, you could see there is a filter drop down list, select the unique column that you don't want to duplicate and then use form variable from the second drop down list and then type the input field name.

let me know once you have the record set created.

Sign in to reply to this post

randyw2394710

ok i have created a record set for database i selected all columns the filter specialName = (for the = part what do i use i thought equal maybe contains does not work for both) form variable specialName

ok i tested it and still intered the duplicate entry maybe not done yet

Sign in to reply to this post

Dani Chankhour

You should select "=". Now for the second step. Select the div that you want to show, and then in the Server Behaviors Panel (Window -> Server Behaviors) click the + button and select show region -> show if record set is not empty.

This will make it so that when the record set is not empty it will show the div.

Sign in to reply to this post

randyw2394710

ok how will this stop the insert into the database if allready exists

Sign in to reply to this post

randyw2394710

ok i got the div to appear when inserted how do i stop an entry

specials_Insert.php

here is example now i want to check if there is duplicate and on insert page show div with error and name allready exists thanks

Sign in to reply to this post

Dani Chankhour

Can you send me your insert page in a zip file and i will tell you what you need to change exactly.

Btw, i just did a test on your site by inserting a test entry twice but i did not get the div to show. I will look into that once you send me your file.

Sign in to reply to this post

randyw2394710

Originally Said By: Dani Chankhour
  Can you send me your insert page in a zip file and i will tell you what you need to change exactly.

Btw, i just did a test on your site by inserting a test entry twice but i did not get the div to show. I will look into that once you send me your file.  



the div appears on the detail page i have attached both insert and detail thanks for help

Attached Files
specials_Detail.zip
Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...