I would like to display (and therefor program) a situation as seen in the attached picture in “Gruppe”. One of these stations is the group head and therefor the radio button is set. It can also be changed, i. e. if another stations radio button is pressed, that one is set (and the previously set station is unset of course).
As the radio button seems only to work with an attached value list, the desired result is not achievable (at least I don’t know how).
Also, in contrast to a checkbox behaviour, which, if no value list is attached, just shows checked when the field contains 1 and unchecked if the field contains a 0, the radio button does not display anything if no value list is attached.
I would like to propose to Servoy to make the behaviour of the radio button similar to the checkbox behaviour, with the constrain that only one (radio button) field in a foundset can contain a 1. This would in my opinion only make the radion button element useful (for such requirements) and conform to it’s purpose to only allow 1 out of n set.
What are others experience? I think currently the radio button functionality is too constraint.
Hmm, as you probably know, you have to ‘group’ radiobuttions for them to behave correct (only one can be selected).
So, for me it makes sense that it needs a valuelist attached.
This is not the case with a checkbox.
How do you suggest Servoy would know what radiobuttons to group to each other?
Hmm, as you probably know, you have to ‘group’ radiobuttions for them to behave correct (only one can be selected).
So, for me it makes sense that it needs a valuelist attached.
This is not the case with a checkbox.
How do you suggest Servoy would know what radiobuttons to ‘group’ to each other?
Yes, I know that it is the visual representation of the rule: 1 out of n has to be selected. But that is exactly what my picture shows - or do you disagree?
Users find that perfectly easy to handle - click on the head station you wish and voila, it’s shown visually
In my opinion the problem is with the (unnecessary) constraint applied to the radio button in it’s actual form, or may be there was never the need to use it that way.
Please tell me if you find that presentation not logical and how you would do it cross-platform, conform to standard OS elements?
Thanks and best regards, Robert
IT2Be:
Hmm, as you probably know, you have to ‘group’ radiobuttions for them to behave correct (only one can be selected).
So, for me it makes sense that it needs a valuelist attached.
This is not the case with a checkbox.
How do you suggest Servoy would know what radiobuttons to ‘group’ to each other?
The stations shown in ‘Gruppe’ look to be separate rows in a related table and so the radio value is a value capable of being set/unset in each row, is that a correct assumption ?
Actually, the stations shown in as a “Gruppe” are done with a recursive relationship, i. e. there is only one table called stations and a 1:m recursive relationship.
The relationship is saying that “EACH station MAY BE group head for ONE OR MORE stations” in the 1:m direction and “EACH station MUST BE grouped by ONE NAD ONLY ONE station” in the m:1 direction.
Harry Catharell:
Hi Robert,
The stations shown in ‘Gruppe’ look to be separate rows in a related table
Harry
Yes, that is a correct assumption.
Harry Catharell:
Hi Robert,
… and so the radio value is a value capable of being set/unset in each row, is that a correct assumption ?
I represented a similar scenario in a solution as follows:
added a column to the related table (if it is recursive then to the current table !) called: ‘comms_preferred’
Formatted that field to be a radio type using a value list which is called ‘1’ and has a single static value of 1 in it
added a method to that column as it appeared in a tab panel which used an onFocusGained trigger which then used the related foundset as a focus to update the ‘comms_preferred’ values
The method simply removes any ‘1’ values in the foundset and then sets the current record with ‘1’ which then satisfies the radio button setting for that row only
Here is the method code and I have attached a screenshot of the representation in the form
/******************
record_select
070627HC
choose a contact number as preferred - fired on focus gained
arguments:
******************/
//clear all values in record set
var fsUpdater = databaseManager.getFoundSetUpdater(foundset)
fsUpdater.setColumn('comms_preferred',0)
fsUpdater.performUpdate()
//set current record
comms_preferred = 1
//update UI
controller.saveData();
application.updateUI();
I am trying your tip but get stuck at 3) as I don’t understand it correctly I think.
Just to make sure I understand your solution: Your shown communication lines (email, Phone, …) are on a related tab, correct? This should give the related number of records, i. e. the foundset?
Are you adding the below method as an onAction method to that (radio button) column?
I get null for the foundset, so there is still something wrong with my trial.
you can also adjust the the column width with the margin settings, e. g. 0,5,0,5, but take care to set the field with the same value as the total, e. g. in this example to 30 px if the field itself is 20 px. And use only top, left for anchors, otherwise the 1 get’s visible again.
Regards, Robert
Harry Catharell:
Hi Harjo,
I see what you mean
Simply make the size of the field the same height and width (in my case 20 x 20 pixels) which excludes the value of ‘1’ from being shown.
I also turn off scrollbars
I attach a screenshot of the form from my earlier post in design mode with the field selected and showing the properties associated with it
Hope this helps … otherwise I’ll send you a simple demo solution
**note that this will have the same effect if you use a checkbox type field instead of a radio - just in case you prefer a tick to a bullet **
The communication lines are in a related tab and this defines the foundset on that related form
The form which shows the related communication lines holds the method
The method is attached to the radio column on the related form
I trigger it onFocusGained but onAction should still work
Robert Huber:
Hi Harry
I am trying your tip but get stuck at 3) as I don’t understand it correctly I think.
Just to make sure I understand your solution: Your shown communication lines (email, Phone, …) are on a related tab, correct? This should give the related number of records, i. e. the foundset?
Are you adding the below method as an onAction method to that (radio button) column?
I get null for the foundset, so there is still something wrong with my trial.
Thanks, Robert
If I get a moment I will send a simple demo but in the interim - Happy New Year
Thanks a lot for the demo. i am feeling quite stupid but I can’t import the solution into the Servoy repository. I thought up to now that the solution file with ending .servoy is the one, but in your solution folder I find only .xml files.
Thanks for help, Robert
Harry Catharell:
Hi Robert,
Small demo which may guide you
Hope that it works as you need…
Cheers
Harry
Servoy Developer
Version 3.5.3-build 516
Java version 1.5.0_13-121 (Mac OS X)
If you managed the rename to ‘radio_flag.servoy’ then in your import solution dialogue you have the option to choose for all filetypes which should then allow you to choose that file even though it may think it is still a ‘zip’ file.
Harjo is right, though, that some machines will assume that the download is a zip file and unzip it to give you the raw contents
Exported Servoy solutions are basically zip files anyway
If this still causes you a problem then email me off forum and I’ll reply direct to you with the export as an attachment which may work better.