Yii Framework Forum: Minor bug on Gii - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Minor bug on Gii breadcrumbs fail Rate Topic: -----

#1 User is offline   saegeek 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 244
  • Joined: 09-December 09
  • Location:Montpellier - France

Posted 01 May 2012 - 03:19 AM

Hi,

The generated view in views/update fails to correctly display breadcrumbs in the case of :
foobar cannot be blank

It's not a joke !

To reproduce:
create an SQL table-->generate a model-->generate CRUD-->create an item-->go to "update item"-->send a blank form and look at the breadcrumbs :D
And [for] their saying, "Indeed, we have killed the Messiah, Jesus, the son of Mary, the messenger of God ." And they did not kill him, nor did they crucify him; but [another] was made to resemble him to them. And indeed, those who differ over it are in doubt about it. They have no knowledge of it except the following of assumption. And they did not kill him, for certain.Rather, God raised him to Himself.
0

#2 User is offline   Maurizio Domba 

  • Yii - Yesss It Is !!!
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,229
  • Joined: 12-October 09
  • Location:Croatia

Posted 01 May 2012 - 03:36 AM

I can't reproduce it... you need to explain that a bit better.. how are the breadcrumbs displayed... how should they look... what you mean with "in the case of foobar cannot be blank"... what is foobar?
Find more about me.... btw. Do you know your WAN IP?
0

#3 User is offline   saegeek 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 244
  • Joined: 09-December 09
  • Location:Montpellier - France

Posted 01 May 2012 - 03:55 AM

foobar is a generic name for an <input type="text">, cannot be blank occurs when a field has a "required" rule.
The breadcrumbs will look like:
Home >> >> Update
instead of :
Home >> item >> Update

Sure it's a minor bug due to :
$model->attributes=$_POST['foobar'];

Where the breadcrumbs try to shows the empty attribute from the empty form sent
And [for] their saying, "Indeed, we have killed the Messiah, Jesus, the son of Mary, the messenger of God ." And they did not kill him, nor did they crucify him; but [another] was made to resemble him to them. And indeed, those who differ over it are in doubt about it. They have no knowledge of it except the following of assumption. And they did not kill him, for certain.Rather, God raised him to Himself.
0

#4 User is offline   Maurizio Domba 

  • Yii - Yesss It Is !!!
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,229
  • Joined: 12-October 09
  • Location:Croatia

Posted 01 May 2012 - 05:16 AM

OK, did reproduce it this time...

Yes, this can happen if you have ajaxvalidation, clientvalidation and validateOnSubmit disabled...
Find more about me.... btw. Do you know your WAN IP?
0

#5 User is offline   bennouna 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,114
  • Joined: 05-January 12
  • Location:Morocco

Posted 01 May 2012 - 05:32 AM

Yes, this can get even tricky when you have a BELONGS_TO relationship and you'd like (like me) to show the hierarchy in the breadcrumbs. High risk of "Trying to get property of non object" when you want to show it like

Home » Parent model's title » Model's title » Update

I guess we can use the model's attributes from db in the breadcrumbs (an additional findByPk(id) will be necessary), and not rely on POST data that may not be valid at the submit time.
0

#6 User is offline   saegeek 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 244
  • Joined: 09-December 09
  • Location:Montpellier - France

Posted 01 May 2012 - 05:36 PM

View Postbennouna, on 01 May 2012 - 05:32 AM, said:

I guess we can use the model's attributes from db in the breadcrumbs (an additional findByPk(id) will be necessary)

Or storage of the breadcrumbs array into a session cookie...
And [for] their saying, "Indeed, we have killed the Messiah, Jesus, the son of Mary, the messenger of God ." And they did not kill him, nor did they crucify him; but [another] was made to resemble him to them. And indeed, those who differ over it are in doubt about it. They have no knowledge of it except the following of assumption. And they did not kill him, for certain.Rather, God raised him to Himself.
0

#7 User is offline   Maurizio Domba 

  • Yii - Yesss It Is !!!
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,229
  • Joined: 12-October 09
  • Location:Croatia

Posted 02 May 2012 - 09:31 AM

Issue on GitHub - https://github.com/y.../yii/issues/665
Find more about me.... btw. Do you know your WAN IP?
0

#8 User is offline   saegeek 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 244
  • Joined: 09-December 09
  • Location:Montpellier - France

Posted 03 May 2012 - 07:21 AM

solved in 2mins:
public function actionUpdate($id) {
        $this->loadModel($id,'update');
        Yii::app()->session->add('item',$this->model->getAttribute('title'));
        ...


in the view:
<?php
$this->breadcrumbs=array(
	Yii::app()->session->get('item'),
	'Update',
);
...
?>

And [for] their saying, "Indeed, we have killed the Messiah, Jesus, the son of Mary, the messenger of God ." And they did not kill him, nor did they crucify him; but [another] was made to resemble him to them. And indeed, those who differ over it are in doubt about it. They have no knowledge of it except the following of assumption. And they did not kill him, for certain.Rather, God raised him to Himself.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users