Don Wieland
2014-08-13 17:41:10 UTC
Hi gang,
I have an issue with updating a text field called "appt_notes" with a string that uses the & and + characters. On one of the forms (which uses AJAX), it does not save the entire text. For example, if I try to save this text:
Right hip + left knee replacement, in a lot of pain, "tried everything" - wants "deep work" - last massage didn't work, rieki and feldon crais didn't work, epidural two weeks ago backfired, still in pain. -DOH
It only saves "Right hip"
The one form from my Appt UI that uses an AJAX call is the one that does not work. Here is the AJAX code:
function saveAppt(no_reload){
try {
var id = $('input[name=id]').val();
var linkid = $('#linkid').val();
var status = $('select[name=status]');
var clientid = $('input[name=clientid]');
var modality = $('select[name=modality]');
var date_start = $('input[name=date_start]');
var time_from = $('select[name=time_from]');
var time_to = $('select[name=time_to]');
var time_field = $('#time_field');
var room = $('select[name=room]');
var user = $('select[name=user]');
var notes = $('textarea[name=notes]');
var appt_notes = $('textarea[name=appt_notes]');
var no_adj = $('input[name=no_adj]:checked').val();
var no_appt_calls = $('input[name=no_appt_calls]:checked').val();
var vml = $('input[name=vml]:checked').val();
var conf_appts_via = $('select[name=conf_appts_via]');
var ins_form = $('input[name=ins_form]:checked').val();
if(typeof id == 'undefined') id = '';
if(typeof linkid == 'undefined') linkid = '';
if(typeof no_appt_calls == 'undefined') no_appt_calls = '';
if(typeof vml == 'undefined') vml = '';
if(modality.val()=='' || modality.val()==null){
$('#mod_cell').addClass('highlight');
return false;
}else{
$('#mod_cell').removeClass('highlight');
}
/*var status_old = $('#db_status_appt').val();
if(status_old == 6 || status_old == 7 || status_old == 11 && ($('#db_status_appt'))) {
$('#status').addClass('highlight');
$('#status').val(status_old);
alert("This STATUS is not allowed because there is a related invoice/payment already created. You will need to delete payment and invoice first.");
return false;
}*/
if((notes.val() == '') && (status.val() == 6 || status.val() == 7 || status.val() == 11 || status.val() == 10)) {
$('#notes').addClass('highlight');
alert("This STATUS requires that you enter a REASON in the Note field");
return false;
}
time_diff = (time_to.val().substr(0,2) - time_from.val().substr(0,2))*60+(time_to.val().substr(2,2)-time_from.val().substr(2,2));
if(time_diff <= 0){
time_field.addClass('highlight');
alert('Min interval is 15 min');
return false;
}else{
time_field.removeClass('highlight');
}
var data = 'act=appt&save=1&id='+id+'&linkid='+linkid+'&clientid='+clientid.val()+'&status='+status.val()+'&modality='+modality.val()+'&date='+date_start.val()+'&time_from=' + time_from.val()+'&time_to=' + time_to.val()+'&room=' + room.val()+'&user=' + user.val()+ '¬es=' + notes.val() + '&appt_notes=' + appt_notes.val() + '&no_appt_calls=' + no_appt_calls + '&vml=' + vml + '&no_adj=' + no_adj + '&conf_appts_via=' + conf_appts_via.val()+ '&ins_form='+ins_form;
$('.inputField').attr('disabled','true');
$('.button').attr('disabled','true');
$('.loading').html(loading_img);
$.ajax({
url: "/utils.php",
type: "POST",
data: data,
cache: false,
success: function (html) {
data_ar = html.split('|');
data_ar[0]=data_ar[0].replace("\n","");
if (data_ar[0]=='id') {
$('.inputField').attr('disabled',false);
$('.button').attr('disabled',false);
$('.loading').html('');
if(no_reload!='1') {
//$('#apptform').fadeOut('slow');
//$('#appt_done').fadeIn('slow');
loadAppt(date_start.val(),'',room.val(), clientid.val(), data_ar[1], $('#av_id').val());
}
//loadCalendar();
//hideDialog();
//alert("\""+html+"1\"");
return true;
} else {
$('.inputField').attr('disabled',false);
$('.button').attr('disabled',false);
$('.loading').html(' ');
//alert("\""+html+"2\"");
jAlert(html.length>0?html:'Sorry, unexpected error. Please try again later.') ;
return false;
};
}
});
return true;
} catch(err){
txt="There was an error on this page.\n\n";
txt+="Error description: " + err.description + "\n\n";
txt+="Click OK to continue.\n\n";
alert(txt);
}
}
The one form from my Client UI that DOES NOT use an AJAX call works. It, also, uses a function to prepare the string to insert into mySQL:
function prepare_input($string) {
if (is_string($string)) {
return trim(stripslashes($string));
} elseif (is_array($string)) {
reset($string);
while (list($key, $value) = each($string)) {
$string[$key] = $this->prepare_input($value);
}
return $string;
} else {
return $string;
}
}
then in the PHP, it is coded like this:
$no_appt_calls = $_REQUEST['no_appt_calls'];
I am really stumped on why it works kine at the Client UI level, but not at the Appt UI level.
Any clues or assistance would be apreciated. Thanks!
Don Wieland
D W D a t a C o n c e p t s
~~~~~~~~~~~~~~~~~~~~~~~~~
***@dwdataconcepts.com
http://www.dwdataconcepts.com
Direct Line - (949) 336-4828
SKYPE - skypename = dwdata
Integrated data solutions to fit your business needs.
Need assistance in dialing in your FileMaker solution? Check out our Developer Support Plan at:
http://www.dwdataconcepts.com/DevSup.php
Appointment 1.0v9 - Powerful Appointment Scheduling for FileMaker Pro 9 or higher
http://www.appointment10.com
For a quick overview -
http://www.appointment10.com/Appt10_Promo/Overview.html
I have an issue with updating a text field called "appt_notes" with a string that uses the & and + characters. On one of the forms (which uses AJAX), it does not save the entire text. For example, if I try to save this text:
Right hip + left knee replacement, in a lot of pain, "tried everything" - wants "deep work" - last massage didn't work, rieki and feldon crais didn't work, epidural two weeks ago backfired, still in pain. -DOH
It only saves "Right hip"
The one form from my Appt UI that uses an AJAX call is the one that does not work. Here is the AJAX code:
function saveAppt(no_reload){
try {
var id = $('input[name=id]').val();
var linkid = $('#linkid').val();
var status = $('select[name=status]');
var clientid = $('input[name=clientid]');
var modality = $('select[name=modality]');
var date_start = $('input[name=date_start]');
var time_from = $('select[name=time_from]');
var time_to = $('select[name=time_to]');
var time_field = $('#time_field');
var room = $('select[name=room]');
var user = $('select[name=user]');
var notes = $('textarea[name=notes]');
var appt_notes = $('textarea[name=appt_notes]');
var no_adj = $('input[name=no_adj]:checked').val();
var no_appt_calls = $('input[name=no_appt_calls]:checked').val();
var vml = $('input[name=vml]:checked').val();
var conf_appts_via = $('select[name=conf_appts_via]');
var ins_form = $('input[name=ins_form]:checked').val();
if(typeof id == 'undefined') id = '';
if(typeof linkid == 'undefined') linkid = '';
if(typeof no_appt_calls == 'undefined') no_appt_calls = '';
if(typeof vml == 'undefined') vml = '';
if(modality.val()=='' || modality.val()==null){
$('#mod_cell').addClass('highlight');
return false;
}else{
$('#mod_cell').removeClass('highlight');
}
/*var status_old = $('#db_status_appt').val();
if(status_old == 6 || status_old == 7 || status_old == 11 && ($('#db_status_appt'))) {
$('#status').addClass('highlight');
$('#status').val(status_old);
alert("This STATUS is not allowed because there is a related invoice/payment already created. You will need to delete payment and invoice first.");
return false;
}*/
if((notes.val() == '') && (status.val() == 6 || status.val() == 7 || status.val() == 11 || status.val() == 10)) {
$('#notes').addClass('highlight');
alert("This STATUS requires that you enter a REASON in the Note field");
return false;
}
time_diff = (time_to.val().substr(0,2) - time_from.val().substr(0,2))*60+(time_to.val().substr(2,2)-time_from.val().substr(2,2));
if(time_diff <= 0){
time_field.addClass('highlight');
alert('Min interval is 15 min');
return false;
}else{
time_field.removeClass('highlight');
}
var data = 'act=appt&save=1&id='+id+'&linkid='+linkid+'&clientid='+clientid.val()+'&status='+status.val()+'&modality='+modality.val()+'&date='+date_start.val()+'&time_from=' + time_from.val()+'&time_to=' + time_to.val()+'&room=' + room.val()+'&user=' + user.val()+ '¬es=' + notes.val() + '&appt_notes=' + appt_notes.val() + '&no_appt_calls=' + no_appt_calls + '&vml=' + vml + '&no_adj=' + no_adj + '&conf_appts_via=' + conf_appts_via.val()+ '&ins_form='+ins_form;
$('.inputField').attr('disabled','true');
$('.button').attr('disabled','true');
$('.loading').html(loading_img);
$.ajax({
url: "/utils.php",
type: "POST",
data: data,
cache: false,
success: function (html) {
data_ar = html.split('|');
data_ar[0]=data_ar[0].replace("\n","");
if (data_ar[0]=='id') {
$('.inputField').attr('disabled',false);
$('.button').attr('disabled',false);
$('.loading').html('');
if(no_reload!='1') {
//$('#apptform').fadeOut('slow');
//$('#appt_done').fadeIn('slow');
loadAppt(date_start.val(),'',room.val(), clientid.val(), data_ar[1], $('#av_id').val());
}
//loadCalendar();
//hideDialog();
//alert("\""+html+"1\"");
return true;
} else {
$('.inputField').attr('disabled',false);
$('.button').attr('disabled',false);
$('.loading').html(' ');
//alert("\""+html+"2\"");
jAlert(html.length>0?html:'Sorry, unexpected error. Please try again later.') ;
return false;
};
}
});
return true;
} catch(err){
txt="There was an error on this page.\n\n";
txt+="Error description: " + err.description + "\n\n";
txt+="Click OK to continue.\n\n";
alert(txt);
}
}
The one form from my Client UI that DOES NOT use an AJAX call works. It, also, uses a function to prepare the string to insert into mySQL:
function prepare_input($string) {
if (is_string($string)) {
return trim(stripslashes($string));
} elseif (is_array($string)) {
reset($string);
while (list($key, $value) = each($string)) {
$string[$key] = $this->prepare_input($value);
}
return $string;
} else {
return $string;
}
}
then in the PHP, it is coded like this:
$no_appt_calls = $_REQUEST['no_appt_calls'];
I am really stumped on why it works kine at the Client UI level, but not at the Appt UI level.
Any clues or assistance would be apreciated. Thanks!
Don Wieland
D W D a t a C o n c e p t s
~~~~~~~~~~~~~~~~~~~~~~~~~
***@dwdataconcepts.com
http://www.dwdataconcepts.com
Direct Line - (949) 336-4828
SKYPE - skypename = dwdata
Integrated data solutions to fit your business needs.
Need assistance in dialing in your FileMaker solution? Check out our Developer Support Plan at:
http://www.dwdataconcepts.com/DevSup.php
Appointment 1.0v9 - Powerful Appointment Scheduling for FileMaker Pro 9 or higher
http://www.appointment10.com
For a quick overview -
http://www.appointment10.com/Appt10_Promo/Overview.html