EasyUI Forum
June 25, 2024, 07:44:18 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: HTML encoding for the post data in CRUD application  (Read 4995 times)
thecyberzone
Full Member
***
Posts: 176



View Profile Email
« on: March 16, 2015, 08:49:15 PM »

In a basic CRUD application saving of Form data is done as follows:

Code:
		var url;
function newUser(){
$('#jobpos').textbox('clear');
url = 'jobpos.save_user.php';
}

function saveUser(){
$('#fm').form('submit',{
url: url,
onSubmit: function(){
return $(this).form('validate');
},
success: function(result){
var result = eval('('+result+')');
if (result.success){
$('#dg').datagrid('reload');
$('#jobpos').textbox('clear');   
} else {
$.messager.show({
title: 'Error',
msg: result.msg
});
}
}
});
}

Now if the post data contains a text filed 'jobpos' and during submit if this field contains special character like Single quote ('), Ampersand (&) or Double-quote ("), what I have to do, if I want to save this data into underlying table using the given url/PHP file jobpos.save_user.php ? Generally we use encodeURIComponent() funtion to encode the text value before sending it to backend, but where we can use it, because individual data is not sent in this case, entire form is submitted and all data is found in the PHP file as $_REQUEST data.

Any help regarding where/how I have to use this encodeURIComponent() function to encode text value containg special character ?
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!