- Screen name: jmartin
- About Me: I am the owner of J. Martin Associates Providing IT Consulting working with IBM systems since 1967 - see website By way of Introduction
- Email ID: jmartin@jmartinassociates.net
jmartin's Profile
8 Posts
9 Responses
0
Followers
Show:
- Expanded view
- List view
Private Message
- I have a PHP program that has a jQuery on a page to run a function and return fields if record is found.I cheecked to make sure it has the:java script for:
<script type="text/javascript" src="/websmart/v8.9/javascript/jquery.min.js"></script>
and the javascript to run the funtion:
<script>
$(document).ready(function()
{
var select = $("#CCARDNO");
select.blur(valccmsn);
});
function valccmsn() {
$.ajax({
type: "POST",
url: "fmccpmtf.php",
data: {
'task' : 'valccmsn',
'CCARDNO' : jQuery('#CCARDNO').val(),
'EXPDATE' : jQuery('#EXPDATE').val(),
'CVV2CVC' : jQuery('#CVV2CVC').val(),
'CHNAME' : jQuery('#CHNAME').val(),
'SFLAG' : jQuery('#SFLAG').val(),
},
success: function(data){
data = JSON.parse( data );
$('#EXPDATE').val(data[0]);
$('#CVV2CVC').val(data[1]);
$('#CHNAME').val(data[2]);
$('#SFLAG').val(data[3);
}
});
}
</script>
and the proper HTML to receive the data:
<tr>
<td>Credit Card Number:</td>
<td>
<input id="CCARDNO" type="text" name="CCARDNO" size="25" maxlength="25" value="$CCARDNO" onblur="setStyleBlur(this.id);" onfocus="setStyleFocus(this.id);" />
</td>
</tr>
<tr>
<td>Expiration Date:</td>
<td>
<input id="EXPDATE" type="text" name="EXPDATE" size="5" maxlength="5" value="$EXPDATE" onblur="setStyleBlur(this.id);" onfocus="setStyleFocus(this.id);" /></td>
</tr>
<tr>
<td>CVV2/CVC Credit Card Security Code:</td>
<td>
<input id="CVV2CVC" type="text" name="CVV2CVC" size="5" maxlength="5" value="$CVV2CVC" onblur="setStyleBlur(this.id);" onfocus="setStyleFocus(this.id);" /></td>
</tr>
<tr>
<td>Card Holder Name:</td>
<td>
<input id="CHNAME" type="text" name="CHNAME" size="25" maxlength="25" value="$CHNAME" onblur="setStyleBlur(this.id);" onfocus="setStyleFocus(this.id);" /></td>
</tr>
<tr>
<td>Street Address:</td>
<td>
<input id="STRADR" type="text" name="STRADR" size="30" maxlength="30" value="$STRADR" onblur="setStyleBlur(this.id);" onfocus="setStyleFocus(this.id);" /></td>
</tr>
<tr>
<td>Zip:</td>
<td>
<input id="ZIP" type="text" name="ZIP" size="5" maxlength="5" value="$ZIP" onblur="setStyleBlur(this.id);" onfocus="setStyleFocus(this.id);" /></td>
</tr>
and the function to run the jQuery:
function valccmsn()
{
// Validate Transaction Code Return TABCDES from file TABCD
// Make all global variables available here
foreach($GLOBALS as $arraykey=>$arrayvalue)
{
if ($arraykey != "GLOBALS")
{
global $$arraykey;
}
}
// Get the key field values which identify the record
$CCARDNO = xl_get_parameter('CCARDNO');
$EXPDATE = xl_get_parameter('EXPDATE');
$CVV2CVC = xl_get_parameter('CVV2CVC');
$CHNAME = xl_get_parameter('CHNAME');
$SFLAG = xl_get_parameter('SFLAG');
// Fetch the row for page
$sqlstr = 'SELECT MCCARDNO, MEXPDATE, MCVV2CVC, MCHNAME, MSFLAG FROM JMALIB/CCMSTF
WHERE ' . ' CCMSTF.MCCARDNO = \'' . xl_encode($CCARDNO, 'db2_search') . "'";
if (!$result = db2_exec($db2conn, $sqlstr))
{
// do any add validation here
// Add row to table:
$execsql = 'INSERT INTO JMALIB/CCMSTF (CCMSTF.MCCARDNO , CCMSTF.MEXPDATE, CCMSTF.MCVV2CVC, CCMSTF.MCHNAME, CCMSTF.MSFLAG) VALUES('
. "'" . xl_encode($MCCARDNO, 'db2_search') . "'" . ' , '
. "'" . xl_encode($MEXPDATE, 'db2_search') . "'" . ', '
. "'" . xl_encode($MCVV2CVC, 'db2_search') . "'" . ', '
. "'" . xl_encode($MCHNAME, 'db2_search') . "'" . ', '
. "'" . xl_encode($MSFLAG, 'db2_search') . "'" . ') with NC';
$result = db2_exec($db2conn, $execsql);
}
else
{
$row = db2_fetch_assoc($result);
if ($row)
{
$MEXPDATE = $row['MEXPDATE'];
$MCVV2CVC = $row['MCVV2CVC'];
$MCHNAME = $row['MCHNAME'];
$MSFLAG = $row['MSFLAG'];
$EXPDATE = $MEXPDATE;
$CVV2CVC = $MCVV2CVC;
$CHNAME = $MCHNAME;
$SFLAG = $MSFLAG;
echo("<span style=\"color: red\"><font font-family:\"Arial\" size=\"3\"><B>credit Card on File!</B></span>" . $CCARDNO);
array_push($sReturn, $MEXPDATE);
array_push($sReturn, $MCVV2CVC);
array_push($sReturn, $MCHNAME);
array_push($sReturn, $MSFLAG);
}
else
{
echo("<span style=\"color: red\"><font font-family:\"Arial\" size=\"3\"><B>credit Card Not on File!</B></span>" . $CCARDNO);
}
}
echo( json_encode( $sReturn ) );
db2_close($db2conn);
}
can any one tell me if you see any erros or what to use to debug this to see if function is running?James R. Martin
J. Martin Associates- 30-May-2014 05:00 PM
- Forum: Using jQuery
I need a jQuery ajax loop to test a field in a file for a value = “END” if not equal wait 10 seconds and check again. After each check write to a div updating some variables on the browser page. When condition value = “END” then exit loop.
Can that be done and it there a example of how to do it.
James R. Martin
J. Martin Associates- 20-May-2014 06:30 PM
- Forum: Using jQuery
I need a way using jQuery to show process bar or clock for long runing job on server and keep browser from timing out?
Does anyone have a solution using jQuery in a php program.
Thanks
James
James R. Martin
J. Martin Associates- 02-May-2014 08:17 AM
- Forum: Using jQuery
Can you on a Input character field right align when loose focus with jQuery ajax?
I can't find a example.
James
James R. Martin
J. Martin Associates- 24-Apr-2014 06:32 PM
- Forum: Using jQuery
I have and TRANS. CODE in my HTML:
[HTML]
<tr>
<td>TRANS. CODE:</td>
<td>
<input id="TCODE" type="text" name="TCODE" size="3" maxlength="3" value="$TCODE" onblur="setStyleBlur(this.id);" onfocus="setStyleFocus(this.id);" />
<div style="display: inline;" id="TABCDES"> <span><b><font size="35" color="$color">$TABCDES</b></font></span></div><br>
ADJ/CN DESCRIPTION:
<input id="ACDESC" type="text" name="ACDESC" size="35" maxlength="35" value="$ACDESC" onblur="setStyleBlur(this.id);" onfocus="setStyleFocus(this.id);" />
</td>
</tr>
[/HTML]
in the function valtscode that is excuted by javascript below:
<script>
$(document).ready(function() {
var select = $("#TCODE");
select.blur(valtscode);
});
function valtscode() {
$.ajax({
type: "POST",
url: "fmadjclm.php",
data: {
'task' : 'valtscode',
'TCODE' : jQuery('#TCODE').val(),
},
success: function(data){
$('#TABCDES').html(data);
$('#ACDESC').html(data);
}
});
}
</script>
The function valtscode below:
function valtscode()
{
// Validate Transaction Code Return TABCDES from file TABCD
// Make all global variables available here
foreach($GLOBALS as $arraykey=>$arrayvalue)
{
if ($arraykey != "GLOBALS")
{
global $$arraykey;
}
}
// Get the key field values which identify the record
$TCODE = xl_get_parameter('TCODE');
// Fetch the row for page
$sqlstr = 'SELECT
TABCD.TABCDES
FROM JMALIB/TABCD
WHERE ' . 'TABCD.TABCODE = '' . xl_encode($TCODE, 'db2_search') . "'";
$color="black";
$sReturn = array();
if (!$result = db2_exec($db2conn, $sqlstr))
{
echo("<span style="color: red"><font font-family:"Arial" size="3">SQL Error! " .
db2_stmt_errormsg() . "</span>");
}
else
{
$row = db2_fetch_assoc($result);
if ($row)
{
$TABCDES = $row['TABCDES'];
$ACDESC = $TABCDES;
echo("<span style="color: black"><font font-family:"Arial" size="3"><B>" . $TABCDES . "</B></span>");
}
else
{
echo("<span style="color: red"><font font-family:"Arial" size="3"><B>Invalid Account Status Code!</B></span>");
}
}
db2_close($db2conn);
}
Returns TABCDES with LOAN PENDING and I echo($ACDESC); which shows: LOAN PENDING
but the aJax in the javascript does not put THE RUSULTS "LOAN PENDING" it in the input field for ACDESC? which will have some added information keyed in by entry prson.
Can any tell me what is required to t put THE RUSULTS "LOAN PENDING" it in the input field for ACDESC?
James R. Martin
J. Martin Associates- 12-Feb-2014 12:33 PM
- Forum: Using jQuery
I have a php program running on iSeries server that list a set of files and I want to
select from the list one or more files and on the client PC use a jQuery to read and
write the records creating a text file on the client PC prompting where to save the text
file.
James R. Martin
J. Martin Associates- 22-Aug-2013 03:12 PM
- Forum: Using jQuery
Can jQuery get table and column(field) attributes Information for each column(field) such astable_text:column(field)_text:blob:max_length:multiple_key:name:not_null:numeric:primary_key:table:type:unique_key:unsigned:zerofill:I tried this:// get column metadata$i = 0;while ($i < mysql_num_fields($result)) {echo "Information for column $i:<br />\n";$meta = mysql_fetch_field($result, $i);if (!$meta) {echo "No information available<br />\n";}echo "<pre>blob: $meta->blobmax_length: $meta->max_lengthmultiple_key: $meta->multiple_keyname: $meta->namenot_null: $meta->not_nullnumeric: $meta->numericprimary_key: $meta->primary_keytable: $meta->tabletype: $meta->typeunique_key: $meta->unique_keyunsigned: $meta->unsignedzerofill: $meta->zerofill</pre>";but could not make it work?
James R. Martin
J. Martin Associates- 13-Aug-2013 02:21 PM
- Forum: Using jQuery
[RESOLVED] Dropped the: echo json_encode($DIDESC);add: echo("<span style=\"color: black\"><font font-family:\"Arial\" size=\"4\"><B>" . $DIDESC . "</B></span>");to the function valciind()____________________________________________________________________________I have a php program that returns #DIDESC successfully but surrounds it with [" "]. How can I get rid of the [" "]? It has a function valciind() that runs a java script when onblur=:<input id="CANCIIND" type="text" name="CANCIIND" size="2" maxlength="2" value="$CANCIIND" onblur="setStyleBlur(this.id);" onfocus="setStyleFocus(this.id);" /><script>$(document).ready(function() {var select = $("#CANCIIND");select.blur(function() {$.ajax({type: "POST",url: "fmcanacct.php",data: {'task' : 'valciind','CANCIIND' : jQuery('#CANCIIND').val(),},success: function(data){$('#DIDESC').html(data);}});});});</script>function valciind(){// Validate Consumer Information Indicator Return DIDESC// Make all global variables available hereforeach($GLOBALS as $arraykey=>$arrayvalue){if ($arraykey != "GLOBALS"){global $$arraykey;}}// Get the key field values which identify the record$CANCIIND = xl_get_parameter('CANCIIND');$DIDESC_ = xl_get_parameter('DIDESC_');// Fetch the row for page$sqlstr = 'SELECTCIICODE.CICODE,CIICODE.DIDESCFROM JMALIB/CIICODEWHERE ' . 'CIICODE.CICODE = \'' . xl_encode($CANCIIND, 'db2_search') . "'";$color="black";$sReturn = array();if (!$result = db2_exec($db2conn, $sqlstr)){array_push($sReturn, "<span style=\"color: red\"><font font-family:\"Arial\" size=\"4\">SQL Error! " .db2_stmt_errormsg() . "</span>");}else{$row = db2_fetch_assoc($result);if ($row){// $CANCIIND = $row['CANCIIND'];$DIDESC = $row['DIDESC'];$DIDESC_= $DIDESC;$DIDESC1 = $DIDESC;if ($DIDESC_ == ""){$DIDESC_ = $DIDESC;}array_push($sReturn, $DIDESC);if ($DIDESC == ""){echo("<span style=\"color: red\"><font font-family:\"Arial\" size=\"4\"><B>Invalid Consumer Information Indicator!</B></span>");die();}}}echo( json_encode( $sReturn ));db2_close($db2conn);}
James R. Martin
J. Martin Associates- «Prev
- Next »
Moderate user : jmartin
© 2013 jQuery Foundation
Sponsored by and others.

