Giter Site home page Giter Site logo

Comments (12)

dynasource avatar dynasource commented on August 30, 2024

within the current state of the software, this is expected behavior.

In order to get the right label, you should use:

 $form->field($formModel->summaryReview, 'rate')
		->textInput([
			'type' => 'number'
		]) ?>

from yii-core.

TerraSkye avatar TerraSkye commented on August 30, 2024

@dynasource woulnt the field name be incorrect then?

from yii-core.

dynasource avatar dynasource commented on August 30, 2024

correct. To my knowledge, this is could be further improved.

from yii-core.

tekord avatar tekord commented on August 30, 2024

$form->field($formModel->summaryReview, 'rate') is another model, which I have to load and validate individually. I want this model to be nested for convenience.

from yii-core.

SamMousa avatar SamMousa commented on August 30, 2024

@TerraSkye AFAIK you could override getAttributeLabel and implement the label resolution there. Ideally you forward it so it takes the label from the related model.

from yii-core.

tekord avatar tekord commented on August 30, 2024

@SamMousa overridding of getAttributeLabel is not working. My form has inputs with names CompletedOrderReviewForm[**primaryReview**][rate], CompletedOrderReviewForm[**summaryReview**][rate] and CompletedOrderReviewForm[**secondaryReviews**][rate], but CompletedOrderReviewForm::getAttribute receives only primaryReview, summaryReview and secondaryReviews as arguments. There is not way to know what field's label of my nested model requested.

from yii-core.

SamMousa avatar SamMousa commented on August 30, 2024

Ah ok;don't know how to get around that.

from yii-core.

TerraSkye avatar TerraSkye commented on August 30, 2024

the only workaround i see is to manually set the label.

from yii-core.

dynasource avatar dynasource commented on August 30, 2024

I agree this to be an issue. Hasnt this been posted before in another ticket?

from yii-core.

tekord avatar tekord commented on August 30, 2024

@TerraSkye do you mean $form->field(...)->label(...)? Field name would be ok, but messages in validation errors are not.

from yii-core.

TerraSkye avatar TerraSkye commented on August 30, 2024

personally i had bad experience by nesting models, the way u presented and therefore i tend to avoid that situation, but yes i understand the issue.

from yii-core.

samdark avatar samdark commented on August 30, 2024

There are no models anymore.

from yii-core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.