× Please submit new Bug Reports on GitHub: github.com/Jensen-Technologies/component-creator-issues/issues

Frontend validation - probably controller bug

7 jaren 9 maanden geleden #1488 door Dariusz
102/5000
Validation does not work on the server side.
Currently it looks like this:
		// Validate the posted data.
		$data = $model->validate($form, $data);

		// Check for errors.
		if ($data === false)
		{
	           some code here
		}

		// Attempt to save the data.
		$return = $model->save($data);

		// Check for errors.
		if ($return === false)
		{
	           some code here
		}

		// Check in the profile.
		if ($return)
		{
			$model->checkin($return);
		}

		// Clear the profile id from the session.
		$app->setUserState('com_pytania.edit.pytanie.id', null);

		// Redirect to the list screen.
		$this->setMessage(JText::_('COM_PYTANIA_ITEM_SAVED_SUCCESSFULLY'));
		$menu = JFactory::getApplication()->getMenu();
		$item = $menu->getActive();
		$url  = (empty($item->link) ? 'index.php?option=com_pytania&view=pytania' : $item->link);
		$this->setRedirect(JRoute::_($url, false));

		// Flush the data from the session.
		$app->setUserState('com_pytania.edit.pytanie.data', null);
It seems to me that it should be so:
		// Validate the posted data.
		$data = $model->validate($form, $data);

		// Check for errors.
		if ($data === false)
		{
	some code here
		} else {
            // Attempt to save the data.
            $return = $model->save($data);
        }

		// Check for errors.
		if ($return === false)
		{
	           some code here
		}

		// Check in the profile.
		if ($return)
		{
			$model->checkin($return);


		// Clear the profile id from the session.
		$app->setUserState('com_pytania.edit.pytanie.id', null);

		// Redirect to the list screen.
		$this->setMessage(JText::_('COM_PYTANIA_ITEM_SAVED_SUCCESSFULLY'));
		$menu = JFactory::getApplication()->getMenu();
		$item = $menu->getActive();
		$url  = (empty($item->link) ? 'index.php?option=com_pytania&view=pytania' : $item->link);
		$this->setRedirect(JRoute::_($url, false));

		// Flush the data from the session.
		$app->setUserState('com_pytania.edit.pytanie.data', null);
		}

Maybe I'm wrong, but after this modification, for me everything is working correctly

Gelieve Inloggen of een account aanmaken om deel te nemen aan het gesprek.

7 jaren 9 maanden geleden #1492 door Andres Maeso
Beantwoord door Andres Maeso in topic Frontend validation - probably controller bug
Hi.

My partners tell me that they successfully received the support ticket via the contact forum and this was fixed yesterday. Thanks for taking the time to report it!

Andrés Maeso
Customer relations manager at Joomla Component Creator.

Dit e-mailadres wordt beveiligd tegen spambots. JavaScript dient ingeschakeld te zijn om het te bekijken.

Gelieve Inloggen of een account aanmaken om deel te nemen aan het gesprek.

Tijd voor maken pagina: 0.049 seconden
Gemaakt door Kunena

We use cookies so that you can place orders and we can provide a better service. You can control the use of cookies at the individual browser level. If you reject cookies, you may still use our website, but your ability to use some features or areas of our website may be limited.