Apostrophe From Database Stopping Javascript!?!

Nov 8, 2007

we had someone write this script for us a few years ago and we thought it was working fine until this week. It uses javascript to generate a dependant drop down menu eg. Depending on what the user chooses in the first drop down menu, (in this case a manual/book title) the second drop down displays the chapter/category headings that are available within that manual and then the users uploads a file that appears under that heading.

If our user adds a chapter/category heading with an apostrophe in it the script quits and the second drop down does not display the corresponding chapter headings. We are storing the info in a mysql database and use php and javascript to extract the data/build the drop down menus. Code:

View 3 Replies


ADVERTISEMENT

Arg Apostrophe!!

Jul 23, 2005

In my form I have an email textfield. Whenever the user enters an email
address the form gets automatically submitted using JavaScript. However,
when a user enters in an email that contains an apostrophe eg:

Mc’Knight. I get a javascript error and the form never gets submitted.

View 1 Replies View Related

Javascript And Database

Oct 12, 2010

I have a calculate.js javascript file where all the function that execute the calculation is consist in this file. Now, I want to retrieve a data from the database for javascript calculation and be done in this calculate.js file. I have search a lot of methods to do this but most said cannot do this from a client-side.

View 9 Replies View Related

Creating A Database With Javascript?

Mar 25, 2007

Does anyone know if this is possible to have a online database? Or can I use access to make a database and then post it online and have it work on the internet?

View 2 Replies View Related

HTML/JavaScript, XML Database...

Apr 27, 2006

I want to make a database which I can put on my USB flash drive, with a html interface, and maybe an xml database. Will I be able to do that?

View 1 Replies View Related

Cf And Javascript W/ Database Query

Dec 27, 2004

i'm having the user input their state (from a drop down list) and type in a zipcode (there are 1,143 zip codes in the database to match to)..

what i want to happen is once the user selects the state they live in, and type in a zip code, i need the page to query the database if the user selected Ohio, and match the counties in the database with the zip code they entered, and then create a drop down list of the counties for them to select the one they live in Code:

View 1 Replies View Related

Quotation Mark Or Apostrophe

May 3, 2006

which of the following two codes is correct and where is the correct notation standardized:

a) alert("Hello World");

b) alert('Hello World');

View 4 Replies View Related

Email Validation With Apostrophe?

Feb 2, 2010

Whoever allowed apostrophes to be valid within emails needs some talking to!

Anyway. I have just found out that this JS function I have been using and have no idea how it works does not allow emails with apostrophes in it. Does anyone know how to alter this code to allow apostrophes?

var pattern = new RegExp(/^(("[w-s]+")|([w-]+(?:.[w-]+)*)|("[w-s]+")([w-]+(?:.[w-]+)*))(@((?:[w-]+.)*w[w-]{0,66}).([a-z]{2,6}(?:.[a-z]{2})?)$)|(@[?((25[0-5].|2[0-4][0-9].|1[0-9]{2}.|[0-9]{1,2}.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2}).){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})]?$)/i);

View 8 Replies View Related

Parameter Containing Apostrophe In A Description?

Jun 6, 2011

I have to pass a certain number of parameters, extracted from DB, to a javascript function.Among them there are for example numbers but also descriptions as names and surnames

Code:
<A href="javascript:doAction("+value+")"></A>"
Where value is a set of parameters formatted for example in the following way:

[code]....

View 7 Replies View Related

Loading Database Data Into Javascript

Nov 20, 2006

im trying to get values from a database and assign them to icons which display on my page. The icons that are generated on the page are generated in javascript- and they do work. Howver i want icons to hold the names that are in the database/table.

how would i do this? would this be using a query result in asp to get the values from the database?? how would i do this? please provide code or guide.

then, how would i assign the database value with the icons???? ive heard javascript arrays??? how would i assign the values??

View 1 Replies View Related

Javascript Database Dependent Dropdowns?

Sep 13, 2006

How would I make my page I have connect to a database using javascript dependent dropdowns? I have all the things I need to get the database working where it displays all the info in the database but I only want it to display based on what they select not all of it.

<?php require_once('Connections/conn_dj.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}

mysql_select_db($database_conn_dj, $conn_dj);
$query_rs_industry = "SELECT * FROM tbl_industry ORDER BY industry_name ASC";
$rs_industry = mysql_query($query_rs_industry, $conn_dj) or die(mysql_error());
$row_rs_industry = mysql_fetch_assoc($rs_industry);
$totalRows_rs_industry = mysql_num_rows($rs_industry);

mysql_select_db($database_conn_dj, $conn_dj);
$query_rs_productcategory = "SELECT * FROM tbl_productcat ORDER BY tbl_productcat.productCat_name";
$rs_productcategory = mysql_query($query_rs_productcategory, $conn_dj) or die(mysql_error());
$row_rs_productcategory = mysql_fetch_assoc($rs_productcategory);
$totalRows_rs_productcategory = mysql_num_rows($rs_productcategory);

mysql_select_db($database_conn_dj, $conn_dj);
$query_rs_product = "SELECT * FROM tbl_products ORDER BY tbl_products.products_name";
$rs_product = mysql_query($query_rs_product, $conn_dj) or die(mysql_error());
$row_rs_product = mysql_fetch_assoc($rs_product);
$totalRows_rs_product = mysql_num_rows($rs_product);

mysql_select_db($database_conn_dj, $conn_dj);
$query_rs_outsidena = "SELECT * FROM intl_countries ORDER BY intl_countries.name";
$rs_outsidena = mysql_query($query_rs_outsidena, $conn_dj) or die(mysql_error());
$row_rs_outsidena = mysql_fetch_assoc($rs_outsidena);
$totalRows_rs_outsidena = mysql_num_rows($rs_outsidena);

mysql_select_db($database_conn_dj, $conn_dj);
$query_rs_state = "SELECT * FROM tbl_states ORDER BY tbl_states.`state`";
$rs_state = mysql_query($query_rs_state, $conn_dj) or die(mysql_error());
$row_rs_state = mysql_fetch_assoc($rs_state);
$totalRows_rs_state = mysql_num_rows($rs_state);
?>
<!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>
<title>DICKEY-john Corporation | Distributors</title>
<link href="_lib/sub.css" rel="stylesheet" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="keywords" content="Distributor, Sales, Purchase, U.S., International" />
<meta name="description" content="Enter your zip or postal code to find the DICKEY-john distributor nearest you." />
</head>

<body>
<div id="black">&nbsp;</div>
<div id="siteContainer">
<?php include("_inc/topNav.inc"); ?>
<div id="headerContainer">Distributors</div>
<div class="divContainer"><div class="horizDiv"></div><img src="/_img/divEnd.png" alt="div" height="16" width="4" align="right" /></div>
<div id="contentContainer">
<div id="fullContainer">
<div id="stretchCrumbs">
<a href="/index.php">Home</a>
» <a class="high" href="/distributors/">Distributors</a>
</div>
<h1>Distributors</h1>
<p>Search for DICKEY-john distributers by specifying any combonation of the<br />
following classifications: industry, product category, product, and state.</p>
<br />

<br />




<h2>North America</h2>

<table class="setTbl listTbl" width="90%" cellpadding="0" cellspacing="0" border="0">
<tr><td>Industry:</td><td>
<select name="industry" id="center">
<option value="">Select an Industry...</option>
<?php do { ?>
<option value="<?php echo $row_rs_industry['industry_name']; ?>"><?php echo $row_rs_industry['industry_name']; ?></option>

<?php } while ($row_rs_industry = mysql_fetch_assoc($rs_industry)); ?>
</select></td></tr>
<tr><td width="125">Product Category: </td> <td>
<select name="prodcat" id="center">
<option value="">Select a product category...</option>
<?php do { ?>
<option value="<?php echo $row_rs_productcategory['productCat_name']; ?>"><?php echo $row_rs_productcategory['productCat_name']; ?></option>

<?php } while ($row_rs_productcategory = mysql_fetch_assoc($rs_productcategory)); ?>
</select></td></tr>
<tr>
<td>Product:</td> <td>
<select name="prod" id="center">
<option value="">Select a product...</option>
<?php do { ?>
<option value="<?php echo $row_rs_product['products_name']; ?>"><?php echo $row_rs_product['products_name']; ?></option>
<?php } while ($row_rs_product = mysql_fetch_assoc($rs_product)); ?>

</select> </td></tr>
<td>State:</td>
<td> <select name="state" id="center">
<option value="">Select a state...</option>
<?php do { ?>
<option value="<?php echo $row_rs_state['state']; ?>"><?php echo $row_rs_state['state']; ?></option>
<?php } while ($row_rs_state = mysql_fetch_assoc($rs_state)); ?>

</select></td>
</tr>
<tr><td>&nbsp;</td><td><input class="PythonButton" type="submit" value="Find" name="{Button_Name}"></td></tr>
</table>
</form>

<br />
<h2>Outside North America </h2>
<table class="setTbl listTbl" width="90%" cellpadding="0" cellspacing="0" border="0">
<tr><td> <select name="outna" id="center" onchange="javascript:document.centerform.submit()">
<option value="">Select a country...</option>
<?php do { ?>
<option value="<?php echo $row_rs_ousidena['name']; ?>"><?php echo $row_rs_outsidena['name']; ?></option>
<?php } while ($row_rs_outsidena = mysql_fetch_assoc($rs_outsidena)); ?>

</select></td>
</tr></td></tr>
</table>
</form>
</div>
</div>
<?php include("_inc/footer.inc"); ?>
</body>
</html>
<?php
mysql_free_result($rs_industry);

mysql_free_result($rs_productcategory);

mysql_free_result($rs_product);

mysql_free_result($rs_outsidena);

mysql_free_result($rs_state);
?>

View 3 Replies View Related

WP-Cufon - Apostrophe Not Displaying Properly

Oct 13, 2010

I've recently added Cufon to a site and generated a font that includes the WordPress Punctuation option. [URL]

However when I try and use an apostrophe in the text it does not appear on the page.

As a potential fix, I tried inserting ' into the HTML tab of the page via the WP dashboard. It works in Firefox. Cufon displays an apostrophe.

However, in Internet Explorer it displays the code and not the apostrophe.

View 2 Replies View Related

Output Data From Mysql Database In Javascript?

Mar 16, 2004

Not sure if this is the correct forum as it covers data retrieved from mysql in a .js file...

I need to grab the last 5 rows from my database (2 fields per row) and list all 5 in a table but from within a .js file that I can externally link to.

I can manage the php / mysql and the output to a .php page but how can this be contained within a .js file?

I believe it is possible but after 2 days of searching on google I'm appealing for assistance.

I realise this could be done with a php include or iframe but that isn't an option and the only way available to import this data is via an external javascript script.

View 3 Replies View Related

Javascript Button & Function For PHP/MySQL Database

May 9, 2007

I have this PHP page that has the following functions...Insert Form into Table in MySQL DatabaseDelete Entry from Table in MySQL DatabaseA Link to a separate page where I Edit entries I have coded a PHP function for Delete. Looks like this:

// delete if provided        if (isset($_GET['id'])) {        // query to delete        $query = "delete from student where STUDENT_ID =".$_GET['id'];        //execute query        if ($db->query($query)) {

Somewhere else I query the results and print them into a table. I added a column to this table with a Delete link for each row. Clicking on delete will execute the PHP function to delete.

The link looks like this: PHP Code:

echo "<td><a href=".$_SERVER['PHP_SELF']."?id=".$row[0]."></a></td>";

Likewise the first names also have links when clicked bring the user to another page with a form to edit form data.

The link looks like this: PHP Code:

echo "<td><a href='editstudent.php?id=".$row[0]."'>".$row[1]."</a></td>";

From here however I need to change those links to Buttons. One for Delete and another for Edit and use JavaScript functions to make them work as they originally did. So this is what I've done...

<td><form name='myform1'><input type='button' name='edit' value='Edit'
<td><form name='myform2'><input type='button' name='delete' value='Delete'

Next I need to write functions...this is where I am lost. Usually I'd know what to do when referencing elements in forms, i'd do something like document.formname.inputname, but my problem is those links or should I call them actions are replaced by those new buttons.

Should I put them into a form, or make them hidden, and then name the element? Or should my function look something like this...all I really want to do is to call the function, and have the function just do the action of loading the link (don't know if that sounds clear). I've tried to do this but it does not work.

<script>
function Delete()
{
document.myform2.action="href='$_SERVER['PHP_SELF']."?id=".$row[0]'";
document.myform2.submit();
}
</script>

Can anyone tell me what i am doing wrong, and could you please point me in the right direction?

View 6 Replies View Related

JQuery :: Apostrophe's Causing Selectors To Fail In IE 6 & 7?

Dec 6, 2011

I have a situation where i need to locate a radio button by it's value and check it. The solution below works in all browsers. However, in IE 6 & 7 (not 8), if there's an apostrophe it blows up.It's happening for me in both jQuery 1.6.4 and 1.7.1. Here's an example. var diagnosis = "Huntington's Disease"; $(...).find('input[value="' +diagnosis+ '"]').attr('checked','checked'); I've tried diagnosis.replace("'","'") and that seems to have no affect.

View 4 Replies View Related

HTML Application - Can Javascript Write To A Local Database?

Jul 23, 2005

IE 6.0 (not interested in other browsers at the moment)

I have looked everywhere I can find to look and googled until I am
cross-eyed and am hoping somebody knows what I'm doing wrong.

I have an HTML application (.hta) working fine, except one thing. I'm
trying to write to a local database from a .htm window (opened from
the main .hta window) and it doesn't work with any of the combinations
I've tried (and I admit to having tried a lot).

Here is one method I've tried:

strSQL = "Update myTable SET myField = 'myValue' WHERE myID = 12;"
var db = new ActiveXObject("ADODB.Connection");
db.Provider = "Microsoft.Jet.OLEDB.4.0";0
db.ConnectionString = "Data Source='c:myDirectorymyDatabase.mdb'";
db.Open;
db.execute(strSQL);

I can easily access the information in the myDatabase.mdb and display
it on the screen.

I can ask for updated information to be input on the screen.

But stuffing that updated information back into the database is the
problem.

Since I'm stuck in an .htm window, I don't have VBScript available, do
I? If VBScript isn't available and it isn't physically possible with
Javascript, then I'll have to revert to .hta windows, where I know I
have VBScript available. But I'd rather do it all in Javascript
within the .htm so as to avoid the security message that pops up when
the .hta opens a new .hta. For various reasons I don't think it is
possible for me to do this whole project within a single .hta.

View 9 Replies View Related

Javascript To Submit To A Page To Edit Item From List Returned From A Database Query.

Feb 23, 2006

I am making a webpage that can query a database table of employees
and return them in a html table. Currently I have submit buttons beside
each employee to open the page to edit their details. I have been using
php/HTML to do this, but wondered if it is safe to use javascript to
just click on the name of the employee to jump to the edit page. I've
been looking on the web for sometime about how to do this without any
luck. Any thoughts?

View 1 Replies View Related

JQuery :: Html To Do Some Database Manipulation - Database Transaction

Jan 11, 2011

Can i use single jquery and html to do some database manipulation i.e. database transaction.

View 1 Replies View Related

Random Word Database - Able To Grab Words From A Database ?

Aug 10, 2010

I want to be able to grab words from a database with javascript. How do I do that?

View 2 Replies View Related

Database Connection - Connect To A Database And Execute Some Queries

Oct 31, 2011

I have been searching how to connect to a database and execute some queries, and then use the data that I get to populate some tables in a web page, all this using javascript.

I am confused because I have seen in some webpages that javascript is not designed to connect with databases, and also I have see other pages where they say that it is possible.

Does anyone know if it is possible to use javascript to connect to a database (informix), and execute some procedures or queries?

View 4 Replies View Related

Validation On A Field For A "last Name" While Allowing For An Apostrophe

May 4, 2010

I am trying to re-work some pre-written Javascript code at which I am a novice at (I'm more CSS, HTML, PHP...). I am trying to validate a form field for a Purchaser's last name while accounting for an apostrophe if they have one in their last name.

I bet it's something simple, but I still haven't been able to figure it out, or write it correctly:

function checkPurchaserName()
{
var err = false;
var f = $(getApogeeElement('purchaser_name_first'));
var l = $(getApogeeElement('purchaser_name_last'));

[Code]...

As an example. I started the purchasing process with the name "Patrick O'Malley".

At the end page where this validation occurs, they have (2) text boxes, one for "first name" and one for "last name". They must type the same exact name for purchaser that they did for applicant, so "Patrick", then "O'Malley"

View 10 Replies View Related

Java - Database - Post Form To Mysql - Only Posting First Letter Of Word/phrase For Text Input Fields To Mysql Database

Jul 13, 2011

I am having no luck with my post form to mysql. It is only posting the first letter of the word/phrase for the text input fields to the mysql database. It is a photo and text post form. The photo and only first letter of text are posting to database. I am using Jqtouch, jquery, and phonegap.

Here is my form fields:

Here is my java script:

View 3 Replies View Related

Stopping Ctl-click In IE

Jul 23, 2005

I have a situation where I want to react to a ctrl-click on a <span> and
it works in Netscape and Firefox browsers but in IE I have a problem.
In IE I do catch the ctrl-click but IE also renders the span in inverse
video, essentially selecting the item.

Here is a short sample that demonstrates the issue:

<html><head>
<script type="text/javascript">

function Clicked(evt){
evt.cancelBubble=true;
}

</script></head>
<body>
<SPAN onClick="Clicked(event);">click me</SPAN>
</body></html>

I thought the cancelBubble would prevent the event from triggering the
selection from happening but I think that the ctrl-click selection
happens before I get control.

Is there a way to prevent the selection from being rendered on ctrl-
click while still allowing my javascript to react to the event?

View 6 Replies View Related

Stopping And Starting A Gif Using JS?

May 7, 2004

I have a gif animation that I want to stop when the user mouses over the gif, and restart when the user mouses out. Is there a way to stop and start gif animation with JS? Or will I have to use Flash instead?

View 3 Replies View Related

Mouseout Stopping A Function

May 12, 2006

I have a function that is activated by a mouseover. The function
triggers an image rotation. I need to stop the rotation on the
mouseout but I don't know how to do this. the mouseover triggers the
rotate() function below. currently the mouseout produces the default
image but then it keeps cycling the other images.

<script language="javascript" type="text/javascript">
if(document.images) {
bubbles = new Image
off = new Image
bubbles.src = "images/bubbles.jpg"
off.src = "default.jpg"
}
else {
bubbles = ""
off = ""
}

adImages = new Array("images/whitemarble.jpg", "images/bubbles.jpg",
"images/oak.jpg")
thisAd = 0

imgCt = adImages.length

function rotate() {
if (document.images) {
thisAd++
if(thisAd == imgCt) {
thisAd = 0
}
document.ImgField.src=adImages[thisAd]
setTimeout("rotate()", 3 * 1000)
}
}
</script>

View 4 Replies View Related

Stopping Animated Gifs

Feb 16, 2007

I'd like to write Javascript that stops animated gifs from animating.

On Firefox, at least, window.stop(); does the trick, although it stops
everything on the page and is kind of unpredictable. If I connect it
to the onload event, sometimes only half the page will be displayed.
Does the onload even fire before rendering?

Does anyone know a reasonable way to accomplish my original goal of
stopping animating gifs from animating?

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved