How to do two-way binding using CanJS?
Enter the Text : <input type="text" name="name" can-value="enteredText" />
Display the Text: {{enteredText}}
Can show multiple approaches? Using ViewModel ?
can-value was the old method in v2. In Canjs 4.0, you would do two way binding like this:
Enter the Text : <input type="text" name="name" value:bind="enteredText" />
Display the Text: {{enteredText}}
See: https://canjs.com/doc/can-stache-bindings.twoWay.html
Here's a jsbin demonstrating the syntax:
http://jsbin.com/vogavevico/edit?html,js,console,output
Please have a look here (docu for v2 and for v3).
At least if you use the (nowadays recommended) components approach you can write
<my-component {(some-prop)}="value"/><!-- v2 -->
<!-- syntax for v3 remains: {(prop)}="key" for two-way binding. -->
This is from the documentation.
Related
I have created a slickGrid APP and want to have placeholders in the search box. I can see an example in the Angular version of the slickgrid, yet couldnt see its code. I am however using the Javascript version.
Can someone help?
Thank you,
B
Check out http://6pac.github.io/SlickGrid/examples/example-header-row.html as an example.
The filter boxes are created using:
grid.onHeaderRowCellRendered.subscribe(function(e, args) {
$(args.node).empty();
$("<input type='text'>")
.data("columnId", args.column.id)
.val(columnFilters[args.column.id])
.appendTo(args.node);
});
So just add the 'placeholder' attribute to the box, eg:
<input type="text" name="fname" placeholder="First name">
I need to change the content language URL Code for the french part of a Website to "costumes" (Found in the language manager under "content"). However the field stops after 7 letters, so that the last "s" is cut of.
I want to change that because the website-languages where set up as categories before, so that the french part is indexed by Google and others like that. Is there a way to allow 8 letters in this field?
Please try to change maxlength variable from file: /administrator/components/com_languages/models/forms/language.xml
<field name="lang_code" type="text"
description="COM_LANGUAGES_FIELD_LANG_TAG_DESC"
label="COM_LANGUAGES_FIELD_LANG_TAG_LABEL"
maxlength="7"
required="true"
size="10"
/>
<field name="sef" type="text"
description="COM_LANGUAGES_FIELD_LANG_CODE_DESC"
label="COM_LANGUAGES_FIELD_LANG_CODE_LABEL"
maxlength="7"
required="true"
size="10"
/>
This is a core change and every time you upgrade your joomla installation you have to check if it is getting overridden. If you want to create an override, you will need a 3rd party plugin.
Good Luck!
I am having an issue when using below code in plugin xml in Joomla 2.5 version.
maxlength is not working.
<field name="phone" type="text" default="" label="Phone"
description="Phone: Must not be greater than 13 numbers" maxlength="13" />
or
<param name="phone" type="text" default="" label="Phone"
description="Phone: Must not be greater than 13 numbers" maxlength="13" />
Please let me know what need to be done or i am doing wrong.
Thanks in advance.
You should definitely be using the first bit of code you've provided in your extension as Joomla 2.5 uses <field>, not <param>.
So once you have many any changes to the XML file, you need to ensure you open the Plugin in the Joomla backend, and click "Save" which will apply any changes made.
I'm new to Selenium Webdriver. I have been using Firebug & Firepath to generate xpath (copy pasting the given xpath) for the web elements, but I am facing problems when using such xpaths(Such as "Xpath cannot be evaluated into an web elemnt").
Please help me with the below example of xpath of a Webelement to create a flexible & generic xpath:
<input type="text" maxlength="15" length="40" value="" name="ST_ACK_NUM"/>
Like the people say in the comments it is better to create a more relative path to your elements. Maybe you can post some more input so the XPath can be created more efficiently.
To get the input with a absolute XPath you can do:
//input[#name='ST_ACK_NUM']
Above XPath will search the complete source to all <input> elements where attribute name equals the value ST_ACK_NUM
When you look at your source maybe you can adjust the XPath and add more dependencies. For example if your input looks like:
<div class="DivClass">
<form name="FormName">
<input type="text" maxlength="15" length="40" value="" name="ST_ACK_NUM"/>
</form>
</div>
You could use a XPath like:
//div[#class='DivClass']/form[#name='FormName']/input[#name='ST_ACK_NUM']
This will also find the <input> element, but with a lot more dependencies.
How to render checkbox within the select box.
Can i use like below code:
<form:select path="test" items="testlist">
<input type="checkbox name="test"/>
</form:select>
Thanks in Advance.
Raj
Ah, it would be nice if it were so easy. No, you can't do this. A select box must contain option tags, and option tags contain text. HTML just doesn't support a multi-select box with checkboxes.
That doesn't mean you can't do it. Typical workarounds involve javascript and jQuery; here's an example. Here's one that doesn't use jquery.
Use:
<input type="checkbox" name="test" checked="checked"/>