Enhance attribute in Ractive is set to false by default - is there a reason for this? - ractivejs

I've been working on a mini project in Ractive, which uses the enhance: attribute.
My question is about the default value for the "enhance" attribute - I notice out of curiosity that this is set to false by default. I would have thought that it would be more sensible to reuse elements where possible in the DOM, surely? I'm sure there is a reason for this, but it's not clear from the docs - is anyone able to explain the rationale behind this please?

Related

How to make MultiValueField with Composite Fields and i18n enabled work properly?

Have anyone tried to have a form with MultiValueField in Magnolia having Composite fields with i18n enabled and is working properly?
Currently, I'm encountering some weird behaviour when adding items to English then switching to other language and adding items again then switch back to English with items all gone. In one JIRA post it said it was already fixed but I still encounter this issue. Also encountered issues in sorting which apparently not supported by the DelegatingMultiValueTransformer.
If so, can you please show me the configuration you use to make this work properly? If needed customisation, can you give me ideas on how to do it?
Would really appreciate any help on this.
Btw, I'm using the latest release 5.4.6 now.
Maybe you don't want to put two questions in one request in the future ;)
Re language issue:
did you check that you have i18n enabled also on the subfields, since you are using deletage transformer? AFAIK with delegate you need to have them enabled on all fields in the hierarchy.
Re transformer & ordering:
IMO the only way out is to write custom transformer. Look at source code of MultiValueTransformer and in the part of the code where it goes just two levels down when checking child values, you need to go deeper.
You would also need to define different structure storage for your values there since one used by the MultiValueTransformer would not suffice for multiple levels.
Perhaps you can extend one of the more specialized MultiValue*Transformer or perhaps you try MultiValueJSONTransformer if storing all values in json array is enough for you (you would still need to extend it and to repopulate values back into dialog when opening dialog for editing).
HTH,
Jan

WP7 - How can I retrieve the mini form of a Path at runtime?

I've got a databound series of predefined shapes (Path with Data="" set) which each trigger the same event when clicked.
I'd like to programmatically access the mini form of the Path.Data property at runtime to be able to persist it.
In this case I could just name the elements and on click check which one, however I'd prefer a more generic solution.
There seem to be some WPF workarounds but I haven't seen any for WP7.
Does anyone know if this is possible? and if so, how to do it?
Thanks.
Looking in to if and how this may be possible I came across http://www.eightyeightpercentnerd.dreamhosters.com/?p=40 and even though it's quite old it explains how a paths data/geometry is parsed in Siverlight.
It leads me to think that you may be better off trying to find a different approach to solving your problem. :(

ASP.NET : Add a value-less attribute to a UserControl

In ASP.NET, you can add custom HTML tag attributes to a UserControl via
myLabel.Attributes['my-custom-attribute'] = "someValue";
// or Attributes.Add()
... but how can I add an attribute that doesn't have a value? For example, (and I'm not saying that this is what I need) the W3C specification only needs the checked attribute present in a checkbox to consider it checked (instead of checked='true' or something).
<span ID="ctl-blah-blah-myLabel" my-custom-attribute>some text</span>
I'm looking into using something like this to tag specific elements on my page for some client-side behavior. I know that I can do the same with classes, but (1) classes are iffy to manipulate server-side, and (2) I kind of don't want to pollute my class declarations just for tagging (that may be weird for some, I know).
I don't think you can, doing what you're asking is not a well-formed document. The W3C specification you are looking at is old, as far as the checked attribute is concerned. Proper form, now-a-days, is to put checked="checked".
While many browsers might accept this, I wouldn't recommend that you do it. What is it that you're trying to accomplish? Maybe there's a better solution.
This is not the approach you want to take. It results in malformed XHTML and malformed ASP.NET. Even the current W3C Specification suggests that what used to be checked is now written as checked="checked" There are two approaches that make sense.
Use an attribute with a boolean value, such as my-custom-attribute="true"
Use classes. You said you don't want to pollute your classes, but there is probably a way to structure your class definitions that this won't be a problem. For starters, you could put markers like this in a separate .css file and make sure you are using appropriate, expressive naming conventions. Done correctly, the overlap between css behavior and display can be seamless.
Using an asp:Literal instead of asp:Label would allow you to do that.

Disabling a control vs hiding a control in ASP.NET

From a User Interface design point of view when is it better to disable a control or to completely hide it. I have attached an example. In both case if the "Enable ASP.NET" checkbox is clicked the "Select. Net Version selector is enabled.
I would argue that it's almost always best to just disable. Hiding controls means you're leaving a portion of your functionality/configurability a mystery to the end-user. Unless there's a compelling reason to keep users in the dark, I wouldn't.
Your example of a checkbox that enables/disables or hides/unhides a dropdown box is a good one. If users aren't aware that checking the box allows them to select further options, they may never check it and find out, because they don't realize the option they're looking for is there.
Many of us, as developers, come from the "try everything" mindset when it comes to using a piece of software. Normal users don't think that way, and that's not a bad thing, either. It just means we have to keep in mind that not everybody will do what it takes to discover a piece of UI that's been hidden. Leaving it visible but disabled lets them see that there's something there for the having should they decide they want/need to use it, rather than leaving them either wondering if the software does something or never even considering that it might.
This really depends on the context of the example. In this case there is some value associated with disabling the control as it provides a visual affordance that enabling the ASP .Net checkbox will have a determinable outcome.
If the outcome of the checkbox is actually a whole series of non related suboptions or the parent control was a dropdownlist which determines which child elements become available then it would be better to hide / show only those elements that are appropriate to the current selection.
One other point, if you are describing "hiding" the controls as control.visible = false in code rather than display:none then remember that the output will actually not be rendered into the browser at all. This may be a concern if you are catering for disabled users with browsers requiring stricter accessibility requirements etc.
To me that depends on user knowledge. If the user knows what should follow I tend to give them as much information as possible so I would show it disabled. If the user is clueless as to what follows I hide as much as possible. Sometimes I do different things on user role and sometimes it depends on the average user of the application and their expected understanding of the underlying issues.
hth,
\ ^ / i l l
I prefer to disabled the control, so the user can see that he may have something to fill out. But it can be usefull to hide it if you are restricted on space.
It really depends on the situation

When to use this keyword style guidelines?

I wanted to know what various guidelines state about the usage of this. Sometimes I use "this." to get the auto popup help versus to make any distinction of the code. I feel this is sorta bad style but can't say for certain.
What do various C# and .NET style guidelines state about trivial this usage?
(Editors please don't remove this post. This is a legitimate question because I am phrasing it as what style guidelines state about this and not opinion where style guidelines are formal guidelines, i.e that one can find on the net and are published.)
You can use control space in the editor to pull up the intellisense box. You should reserve using this explicitly to situations where not using it would cause confusion.
It makes more sense to use 'this' than to resort to a naming or prefix scheme in order to be less ambiguous. Since the point is usually to make code more readable using 'this' allows for clearer interpretation and less chance of bugs.

Resources