Jump to content

Retain Values in form after redirect


anujgarg

Recommended Posts

Hi,

 

I am using a form in joomla that after submitting is being redirected to the same page containing form. I am also using server side validations into it. My problem is: when a server side validation occurs after submitting a form with a blank field, then I lose my form values that I filled before submitting the form.

 

This is what I am using:

$row->pkg_name = JRequest::getVar( 'pkg_name', '','post', 'string', JREQUEST_ALLOWRAW );
      $row->int_desc = JRequest::getVar( 'internalDesc', '','post', 'string', JREQUEST_ALLOWRAW );
      $row->ext_desc = JRequest::getVar( 'externalDesc', '','post', 'string', JREQUEST_ALLOWRAW );

if($row->pkg_name == "")
         $msg = "Package Name must have a value";
      else if($row->price == "")
         $msg = "Price must have some value";
      else if(!is_numeric($row->price))
         $msg = "Price must have numeric value";

switch($show)
         {
            case '1':
              $msg  = 'Package Modified';
              break;
            case '0':
              $msg  = 'Package could not be modified.';
              break;
            default:
         }

$this->setRedirect($link, $msg);

The form is being redirected to the same page containing form but all values lost.

 

How can I retain them? Please suggest...

 

Thanks

Anuj

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.