0

In my form I have a text field that has data such as >2012-01-01 <2012-02-01 but when I serialize the form and post the data the field only has the >2012-01-01 and not the <2012-02-01.

Where did it go?

$("#grouppositionsform").live("submit",function(e){ e.preventDefault(); $('body').addClass('wait'); $.post("/page.php",$(this).serialize(), function(data){ $('.showdirectory').fadeOut('slow', function() { $(".showdirectory").html(data); $(".showdirectory").fadeIn("slow"); }); }).error(function() { //alert("error"); }).complete(function() { //alert("complete"); $('body').removeClass('wait'); }); }); 
2
  • pls show both html and jquery Commented Dec 5, 2012 at 4:21
  • I've added the code that posts the form. Commented Dec 5, 2012 at 4:33

1 Answer 1

1

The answer is that joomla took that character and said no to it and didn't parse it. So the jquery was fine and was posting the data but joomla has a function that makes sure returned data is safe.

So when I checked $_POST["searchstring"]; all the data was there.

When I use JRequest::getVar("searchstring",-1); it protects me and removes the <.

As it happens Joomla explain this here: http://docs.joomla.org/Secure_coding_guidelines and I changed getVar to allow the data through.

So this worked for me. $sstr = JRequest::getVar("searchstring",'-1','REQUEST','STRING',JREQUEST_ALLOWRAW);

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.