SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 328 | Next

James Kennard

"Mastering Joomla! 1.5 Extension and Framework Development"

This example demonstrates how we might add the field value of myField
to the myForm session namespace:
// get the session
$session =& JFactory::getSession();
// get the raw value of myField
$myFieldValue = JRequest::getString('myField', '', 'POST',
JREQUEST_ALLOWRAW);
// add the value to the session namespace myForm
$session->set('myField', $myFieldValue, 'myForm')
When we come to display the form we can retrieve the data from the session using
the get() method. Once we have retrieved the data we must remember to remove
the data from the session, otherwise it will be displayed every time we view the form
(unless we use another flag as an indicator). We can remove data items from the
myForm namespace using the clear() method:
// get the session
$session =& JFactory::getSession();
// Remove the myField
$session->clear('myField', 'myForm');
The final thing we do in the No route is to redirect the user back to the input form.
When we do this, we must add some messages to the application queue to explain to
the user why the input has been rejected.


Pages:
316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340
druga wojna światowa Free English grammar and study guid hotel jelenia góra Russian bride counter strike 1.6