MVC #Html.ValidationSummary Default Text - validation

Is it possible to set any global defaults for use with the #Html.ValidationSummary?
We're using it throughout our solution and want it always to show the same text. For example, we can achieve the text as follows:
#Html.ValidationSummary(False, "Validation Errors Occured")
However, we want to avoid the developer needing to specify the text. Instead, we'd like them to simply code as follows:
#Html.ValidationSummary()

Not providing you exact answer you are looking but you can create new extension method as per your need for validation summary. and use that method across the site for validation summary. You will have more control on your create code.
Have a look at this post how James created new method for it.

Related

UFT/QTP dynamical url

i have this problem, an "url" has a "token" which generates a random number.
When i try to manipulate an object in this "url" during the run session, UFT doesn't recognize the object because the "url" change.
For example:
record::
Browser("url").Page("dynamicalUrl").WebButton("cancel").Click
'The url value of Page( "dynamicalUrl") is for example: https://example.com/token=542654364678
Run Session::
UFT crashes in the step, because it doesn't recognize objects and the url value of Page( "dynamicalUrl") changes to: https://example.com/token=987757858
Is there any solution to this?, if someone know how to solve this, thanks in advance.
if you only need the cancel button try to make the object dynamic
Use the spy to review properties and select the most appropriate ones.
Browser("index:=0").Page("name:=Page").WebButton("name:=Cancel")
There is no need to have any description for Page objects. Every Browser has only one Page, the reason UFT has this object at all is to create manageable object repositories.
Usually it is a Bad Practice to use the URL as a Page identififer. Try to use the title property instead.
In case you need the URL, use it as a Regular Expression. If your token is just numbers than the regexp is something like:
https://example.com/token=\d+
Generally speaking whatever is a dynamic part in a Property you need to use Regular Expressions for that

How to recuperate field value in others forms in section template in Orbeon

I have a section Template'Section_library',in 'Section_library' i have a field 'first-name' who recuperate the value field from another section in my form so i used this expression
xxf:component-context()/root()/form/Section_TWO/mycontrol.
this expression not worked totally,the recuperation is done when i try to write in this field 'first-name'. i want a solution that automatically recuperate the value within any interaction of user.
I find this issue #3008 but i didn't understand it.
As of 2016.2, there is no reliable and supported way for code inside a section template to access information about the form it is used in. This is by design, but there are reasonable use cases that call for a section template being able to access things from the "outer form", and you're correct pointing to RFE 3008. For now I'd recommend you follow this issue.

ApiBlueprints parameter that yield result like Stripe's errors "attributes"?

I'm new to Stripe and I'd like generate a result that looks like the "Attributes" part of the Errors part : https://stripe.com/docs/api/curl#errors
It's looks like a table with two column, even though it's not a table.
I don't know how I can make this.
For information, I'm using Aglio to generate the template.
Cyril,
There is no easy way to do this in Markdown that I know of. You have two options:
Create your own layout template that manually adds this information, then tell aglio to use it.
Include some basic HTML in your API Blueprint. Here is an example. It just creates a definition list which describes the error attributes using the same CSS that already exists on the page to describe URI parameters.
You can use Markdown to create the tables of response types and codes, and if you want to use a three-column layout you can use the middle and right CSS classes.
Hope this helps!

Joomla component "attachments" allow html in input

this question might be a bit special. I am using this Joomla 2.5 extensions to give authors the abilty to add Attachments to articles: Joomla Attachments
The extension renders an input field called "description" in a backend form to insert an file description for the provided file. Unfortunately it´s not taking HTML tags which I need. By saving the form it seems a strip_tags() or preg_replace() or something similar cleans the input. I combed through the code of the attachments extension but couldn´t find a place where the input is cleaned or saved.
To hopefully stay in the Question + Answer rule of Stackoverflow:
Is there a class which extensions inherit from the Joomla Core to save form data to a DB-table ( which also could be responsible to clean and validate user input )?
thanks for any idea,
tony
You should see how the field is defined first:
1. Form definition
look into the
administrator/component/yourcomponent/models/forms/somename.xml
there you could find a form definition, if so it will also specify the field type: depending on the type there are several available filters; for example the default textarea will strip html, and you need to set
filter="raw"
in order to enable it. see http://docs.joomla.org/Standard_form_field_and_parameter_types for a list of fields, click and you can find the available format options.
2. model
If the model inherits from JModelAdmin or JModelForm or other JModel* it will automatically handle binding of the forms' data to the database, look for the Save function which should receive the form $data.
3. more
There are at least another dozen possibilities. If the above didn't help, try finding the form: possibly you could find it just by looking at the markup. Once you have the form, check the following fields:
option
task
view
This should help you find the php code that is invoked based on the form:
if view is set, maybe in ./views/someview/view.html.php you could find the saving logic.
if task is set, look for a function with the same name in ./controller.php
if task contains a ".", look for the controller in the ./controllers/ folder.
if option is not the name of your component, your component is sending the data to another component for saving, and most likely set a return-url

How to load the layout at runtime in Magento?

I know that we can design the layout in *.xml then in the action just invoke loadLayout, and renderLayout to render the blocks/views.
But, I have a question is:
- How can I load the layout at runtime?
If we have an action which does not really design its layout and will be decided how to render at runtime.
You can please consider the answer from the question for more clear.
Writing a new answer because it seems that you actually DO still want to render, you just want to render a different route's layout XML updates. I believe the _forward() method from Mage_Core_Controller_Varien_Action will allow you to do what you are describing with the least amount of pain.
You should add your action controller directory ahead of the catalog directory, create a ProductController with a viewAction, and check customer is not logged in - in this check you would call $this->_forward('customer','account','login');.
This approach though is going to require more effort in order to be usable, as I imagine that you want the user to be sent to the product page upon login. Have you seen Vinai Kopp's Login Only Catalog module? It should do this for you.
loadLayout() and renderLayout() just execute block output method toHtml() (usually) and take the resulting strings and apply them to the response object via appendBody(). In an action controller you can just call $this->getResponse()->setBody('response string'). How you build the string is up to you.
You can also use Mage_Core_Block_Flush to immediately send output to the browser without using the response object.

Resources