New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
input type='checkbox' not working properly in new version #42
Comments
Thanks for posting this here. I'll try to get back to you on this soon... (I just updated above to show the HTML) |
Not sure why this would not be working. There is an example here in the samples: http://borismoore.github.com/jsviews/demos/step-by-step/10_todos.html Does the sample work for you? |
In the example, if I change this line from: $.observable( Todos.items ).insert( Todos.items.length, { content: this.value, done: false }); to: $.observable( Todos.items ).insert( Todos.items.length, { content: this.value, done: true }); Then, you can see the issue. The checkbox is not checked when adding a new item. |
OK, got it. This should work:
They way it works is that "foo" is shorthand for "{:foo:}" which is the data linking equivalent of {{:foo:}} The : on the left says bind to the data as in data-getfrom. The : on the right is optional, and means bind back to the data, as in data-to. You can add convert and convertBack functions as data-link="{convert:foo:convertBack}" If you want multiple targets, you prefix the {} with the target, so that means that data-link="check{:done}" is binding the done data to the checked property. Currently JsViews does not know how to do two-way binding on the checked property, so you have to add a separate term to have the two way binding - in fact you are binding on onBlur from the value (the default property for an input) to the data. I can probably make JsViews know that check is the default property if type is checkbox, so that using data-link="foo" for checkboxes will just work. But for now the syntax above will get the scenario working. |
Thank you for your response, and the explanation. Maybe you can put the "checked{:done} {:done:}" in the "10_todos.html". That's the only place I can find example for check boxes. A simpler syntax would be good. But as long as there are explanation and examples, it is sufficient. My project now works fine. Thanks for your wonderful libraries. |
Binding to textarea, select, radio buttons and check boxes now fully supported. |
Thanks for this update. I will check this out. --Peter On Wed, May 9, 2012 at 6:30 PM, Boris Moore <
|
I tried linking to checkboxes but it is not working completely. in demo 7 you will find on line 57: <div>Currency Picker: <input type="checkbox" data-link="~app.chooseCurrency" /></div> This seems to work fine. When you check the checkbox the currency convertor shows. when you uncheck it, it hides again. Now change line 99 to read like this: app: {chooseCurrency:true}, This should make the form start with the currency converter visible (after filling in the first fields). The converter does show initially, but the checkmark on the checkbox from line 57 is NOT set. To me this means data-linking for checkboxes is still broken. It can be worked arround by linking to checked property explicitly, but if this is all working as designed I suggest updating the example to reflect this necessity. ** sorry for multiple edits on this, but git markdown seems to be to complicated for me, and the html won't show without. |
reopened to track issue called out by bzuidgeest. I have a fix for this, by the way, but it is part of a much bigger set of changes I am working on, so may not show up immediately... |
This has been fixed in latest commit (counter 21). See also the new sample page, which includes radio buttons, at |
if type="ckeckbox" default setting value = 0, change it to value = false.
|
@omprakash-sharma : I don't understand the comment above. Was this some issue you are raising? selectboxes is not a standard HTML input type... |
Sorry for inconvenius, but i had same issue then followed formio standard
json format. Issue resolved for me.
If my comment is not right, i'll remove.
…On Fri, 26 Oct 2018, 23:20 Boris Moore, ***@***.***> wrote:
@omprakash-sharma <https://github.com/omprakash-sharma> : I don't
understand the comment above. Was this some issue you are raising?
selectboxes is not a standard HTML input type...
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#42 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AS4Cz6QycEi-Lcvu_kkDaphO6irV78e0ks5uo0t0gaJpZM4AELEf>
.
|
Not a problem, but trying to understand. So you are using jsviews together with form.io? Are you also using Angular or React. Are you using JsViews data-linking, or just JsRender templates? |
Yeah, I was just exploring form.io with Angular.
…On Sat, 27 Oct 2018, 00:13 Boris Moore, ***@***.***> wrote:
Not a problem, but trying to undestand. So you are using jsviews together
with form.io? Are you also using Angular or React. Are you using JsViews
data-linking, or just JsRender templates?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#42 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AS4Cz5BHqqPUMucK0ANs30unJeuZSlgqks5uo1fsgaJpZM4AELEf>
.
|
In previous version (before Mar 6 update), I used this syntax to get and set value for checkbox:
If I use the new syntax like this:
If Alarm property is set to true, it doesn't show as checked at the checkbox. However, I can see that in the view model, the property can be updated when user check or uncheck the checkbox.
What should I do for the new version?
The text was updated successfully, but these errors were encountered: