How to change the tag of the default Errors decorator within Zend_Form? - zend-form

I'm trying to change the tag of the Errors decorator, currently it's:
<ul class="errors">
<li>error message</li>
</ul>
I'd like to remove the <ul> wrapper and change the <li> by ie <p>.
I tried a lot of things, but can't get it to work..
Any ideas?

You can't change the default tags of the Errors decorators because it calls the default views helper Zend_View_Helper_FormErrors and you've no way to pass paramaters.
So you'll to write your own Decorator & View Helper.
I did something similar to wrap errors into <label> elements
I created LabelledErrors decorator which calls a FormLabelledErrors helper and reset the default decorators, replacing the Errors decorator by my own.

Related

I want to use t method for href of a tag and custom data attribute instead of nuxt-link when using Nuxt.js + i18n

Dynamic multilingual sites from the backend to the replacement of large sites
I changed the language, but this time I am trying for the first time to do it at the front desk (Nuxt.js + i18n).
<a href="https://gooogle/en.com" data-link="fugafuga">
Without using nuxt-link
<template>
<a href="https://gooogle/{{t('locale')}}.com" data-link="{{t('hogehoge')}}" >
</template>
Is it possible to divert and use a tag as it is?
(In the above writing method, an error occurred and it was useless, so please teach me a workaround)
I18n t method wrapped in quotes in inside tag quote
How do I write it?
Such a shape is desirable because the scale is too large
We apologize for the inconvenience, but we would appreciate it if you could teach us.
thank you.
Suggested fix:
<template>
<a :href="`https://google/${t('locale')}.com`" :data-link="t('hogehoge')"></a>
</template>
You can read more about data binding with Vue/Nuxt here: https://v2.vuejs.org/v2/guide/class-and-style.html#Object-Syntax

Aurelia: How can I modify sidebar content from inside a router view?

I'm trying to wrap my head around how "inner components" can adjust the content of "outer components". Let's say I have an application template that looks something like this:
<template>
<div class="sidebar">
<div>Some app-wide content</div>
<div>
<!-- I want to put some view-specific content here -->
</div>
</div>
<div class="main-body">
<router-view></router-view>
</div>
</template>
Each subview wants to render different content to the sidebar. Obviously this would be easy if the subview included the sidebar area itself, but let's say it is important to preserve the structure and we don't want to replicate the boilerplate of the sidebar across every view.
Is there any way for a child view to declare "export this extra component for display in another place?" I imagine something like injecting the parent view and calling a method on it, but I can't figure it out from the documentation.
Simple demo:
It's fairly simple, actually. Just import and inject your sidebar or any other viewmodel and call a method or update a property.
https://gist.run/?id=745b6792a07d92cbe7e9937020063260
Solution with Compose:
If you wanted to get more elaborate, you could set a compose view.bind variable to that your sidebar would pull in a different view/viewmodel based on the set value.
https://gist.run/?id=ac765dde74a30e009f4aba0f1acadcc5
Alternate approach:
If you don't want to import, you could also use the eventAggregator to publish an event from the router view and subscribe to listen to that event from your sidebar and act accordingly. This would work well for a large app setting where you didn't want to tie them too closely together but wanted the sidebar to react correctly to unpredictable routing patterns by always responding when triggers were published.
https://gist.run/?id=28447bcb4b0c67cff472aae397fd66c0
#LStarkey's <compose> solution is what I was looking for, but to help others I think it's worth mentioning two other viable solutions that were suggested to me in other forums:
View ports. You can specify multiple named router views in a template and then populate them by passing in a viewPorts object to the router instead of specifying a single moduleId. The best source of documentation is a brief blurb in the "Cheat Sheet" of the Aurelia docs.
Custom elements. It's a little more "inside-out" but you could define most of the outer content as a custom element that has slots for the sidebar and the main body; each child view would define this custom element and pass in the appropriate pieces.

Is there a way I can choose where ASP.MVC places my form validation errors?

I am using ASP.NET MVC 4 HTML.BeginForm and it creates a validation-summary-errors class as
below. This doesn't fit with my layout. Is there a way that I can make it put the
validation div class in a different place?
<form action="/User/Account/Login" method="post" novalidate="novalidate">
<div class="validation-summary-errors">
<ul>
<li>The user name or password provided is incorrect.</li>
</ul>
</div>
<fieldset>
<legend>Local Login</legend>
<ol>
<li>ation-summary-errors in a different position?
Well, sure, it's up to you to put the #Html.ValidationSummary() helper call which generates this markup wherever you want. As far as controlling the exact markup that this helper spits, that would be much more difficult because this helper offers you almost no control over the generated markup.
If you need to have more control you could write a custom helper.
You can use #Html.ValidationMessage("validation-errors") and put it in any HTML tag and then can use CSS to give it a style.

Usage of select() function to identify binding template in HTML

I have not been able to find any documentation for the select() function that I have seen used to identify binding templates in Windows 8 store apps, nor have I been able to find it defined in the WinJS base.js or ui.js files. It seems to work like a normal CSS selector to identify the itemTemplate:
<div id="listViewTemplate" data-win-control="WinJS.Binding.Template">
<h1 data-win-bind="textContent: firstName"></h1>
</div>
<div id="listViewDiv" data-win-control="WinJS.UI.ListView"
data-win-options="{itemTemplate: select('#listViewTemplate')}"> <==== HERE <====
</div>
When identifying a binding template by its id, the use of the select() function seems to be optional. However, if using its class name, select() seems to be required.
Where is the select() function documented or defined?
It's in base.js, line 2712, and ultimately calls querySelector (or querySelectorAll)
If you put a breakpoint at _evaluateObjectQueryExpression in base.js (around Line 6154) and step through, you'll get some insight as to how the value is parsed.

ReferenceError: JQOTE2_TMPL_EXEC_ERROR is not defined

I am using Jqote2 for my project. whenever i try to call a particular lambda by $.jqote , it is saying "ReferenceError: JQOTE2_TMPL_EXEC_ERROR is not defined"
the template corresponding to the lambda is sound and the parameters that i am passing to the lambda are logically and syntactically correct. and i am doing sync ajax call while loading the template therefore no chance of template not loading.
the template i am using is
<div class="facet"><h4><%=decodeURI(this.attributes.label)%></h4>
<%if("true"===decodeURI(this.attributes.autoExpand)){%>
<ul style="display:block">
<%}else{%>
<ul style="display:none">
<%}%>
<%=window.createonline.service.FacetService.buildFacet(this.item)%>
</ul></div>
I tried moving the elements around,in vain.
What may be the error?
Plz help!!!
Seems like this has no answers.
and now,the specs to my project has changed,and this is no longer required.