View Full Version : Radio buttons to update a datapath
In this tutorial, http://www.laszlosystems.com/lps-2.2/docs/guide/data_app.html , they use:
<dataset name="dset" src="../phonebook.xml"/>
...
<view datapath="dset:/phonebook/contact">
...
<edittext name="firstName" datapath="@firstName" x="80" y="10"/>
...
parent.parent.datapath.updateData();
The new data is taken from the text field, which can be editied.
Can this be done with radio buttons? I've tried using the name attribute of the radio button tag, but that doesn't seem to work.
tim_melton
09-11-2005, 07:42 PM
example, I am dragging an object around in the view. I needed to store the new position in my datapath
solution:
I had to create an edittext field that was hidden and then have the mouseup event set the edittext box to the new value of this.x
then I called updateData and the local xml datapath updated correctly. Apparently there is currently not a way to bind data to a non-editable field. I did try this with an inputtext but with out success.
You could do something similer with the onclick event for the radio button.
spoco2
09-11-2005, 08:15 PM
Try binding the value of the radiobutton using this syntax value="$path{'@firstName'}"
Assuming that the radiobuttons are within a view with a datapath as you've done, that should work... it works for sliders.
spoco2
09-11-2005, 08:18 PM
Actually the datapath would have to be applied to the radiogroup I would imagine, not the individual buttons... they select what value to assign to the datapath.
tim_melton
09-11-2005, 08:39 PM
regarding the example I described, I am dragging views around the screen and need to store their locations
is there a way to directly connect the view x attribute to update the datapath myx attribute without doing what I described?
spoco2
09-11-2005, 08:48 PM
Originally posted by tim_melton
regarding the example I described, I am dragging views around the screen and need to store their locations
is there a way to directly connect the view x attribute to update the datapath myx attribute without doing what I described?
Wouldn't you have to do some things with a method and with the onX/onY or perhaps the onmousedown and onmouseup events?
tim_melton
09-12-2005, 08:27 AM
I have a mouseup event but nothing I did would change the datapath data until I put in an edittext field in the view and then changed the value of the text field. that works fine it just seems hokie.
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.