Hi pino,
First off, there's a logic error in my previous post, there should be no exclamation mark (1) in front of empty(). I'll update the post once I'm done with this one..
The JRequest::getString() method is used to retrieve one field value, not multiple. In order to test multiple fields, you'll have to test each field at a time. A very simple version would be something like this, reporting the very first error it finds:
<?
if (empty(JRequest::getString('text_1')))
return "text_1 may not be empty!";
if (empty(JRequest::getString('text_2')))
return "text_2 may not be empty!";
if (empty(JRequest::getString('text_3')))
return "text_3 may not be empty!";
?>
If you really don't care to inform the user which field was empty, you could also do it like this:
<?
if (empty(JRequest::getString('text_1')) || empty(JRequest::getString('text_2')) || empty(JRequest::getString('text_3')))
return "There was an error validating the submitted data, please check your data and try again!";
?>
To do it a little more complex, you could try something like this, which will report a list of all failed tests:
<?
$validate_errors = "";
if (empty(JRequest::getString('text_1')))
$validate_errors .= "text_1 may not be empty!<br />";
if (empty(JRequest::getString('text_2')))
$validate_errors .= "text_2 may not be empty!<br />";
if (empty(JRequest::getString('text_3')))
$validate_errors .= "text_3 may not be empty!<br />";
if (!empty($validate_errors))
return "There were errors while validating the form:<br />" . $validate_errors;
?>
/Fredrik