Readonly - dropdown and radio not working

Barcellos

Ana Barcellos
I'm having problems to lock dropdown, cascading dropdown and radiobutton elements.
When I set a radiobutton true, the dropdown element should change to readonly state but it keeps on edit mode.
It works when the plugin is "field".

It works when I use "disabled" instead "readonly" but it's not usefull for me because it saves the data as null.

I'd really appreciate if someone could help me to solve this problem because it's a production site and I need to fix it as soon as possible. I'm struggling for more than a week. :(

Code:
if ($$('#tablename___radiobuttonelement input[name=tablename___radiobuttonelement[]]:checked').get('value') == 'true') {
 
$$('#tablename___dropdownelement_1').set('readonly', true);
 
$$('#tablename___cascadingdropingdownelement_2').set('readonly', true);
 
}
 
else {
 
$$('#tablename___dropdownelement_1').set('readonly', false);
 
$$('#tablename___cascadingdropingdownelement_2').set('readonly', false);
 
}
 
Hey, maybe I can help.

Firstly I think it is important that each of these fields, especially radiobutton and dropdown you establish them a default value, this can be done in the configuration menu for each of these elements. This will help to give a pre-established each element when reading the form value.

Secondly, maybe you could work better if you make the condition from the same element as using yes / no to activate the other fields, but JavaScript. Each element has the option to use javascript in the setup menu.

With this option you can make from your element condition, hide or show the other two elements of value dependiedo item condition. You do not even have to know javascript for this, just know how to use the controls and a little common sense.

Ejemplo.PNG

In this example, I am using a yes / no control.
a) The action is load, which means that the condition will run from the moment you read the form
b) After you decide whether the condition will be published or not (the default is "Published")
c) Then comes the command to perform, in this case is "hide" (to hide the item below.
d) Select the item you receive instruction, (Here I chose this field of my form is hidden if the condition is met when opening the form)
e) The operator of the condition, ie, ==, <=, <, etc..
f) The value to compare in this case should be "0" zero, as for a control yes / no value "No" is "0" and "Yes" is "1"

Then do the reverse, that is to say, create another condition you changing the values ??of c) to "Show" and f) to "1" to show (subsection d) element hide to show whether the value read form is iguar 0, ie, "Yes"

please let me know if this might help.
 
I just read your previous post, and I realize you've had problems with javascript to hide & show using the yes / item no, as you've written I think I know what the problem is: you assign the value yes or no, when in reality you must set the value "0" or "1", as I explain in the previous example.

What matters is the value of the field and not the label.

Some fields allow you to set the field value and label to show, but in reality what is stored in the database is the label and is using fabrik for the condition.
 
Thank you, Tirso, but my problem isn't with "hide and show". I want to show all the fields but I don't want them to be editable by users when a value is selected in other element.

Anyone?
 
We could say a dropdown element is always "read only" since we can't edit it but only select one option, right?
Maybe that's why the code ('readonly', true) doesn't work with dropdown and checkbox elements although it works with "field".

So maybe I should try disabling not selected options, something like
Code:
('option:not(:checked)').set('disabled', false);
but I can't find the correct way to put this inside my code.
Could you please help a lady in trouble, guys?


Code:
if ($$('#atividades___acordo_guru input[name=atividades___acordo_guru[]]:checked').get('value') == 'validado') {
            $$('#atividades___atv_0').set('readonly', true);
            $$('#atividades___atv_1  (????)  .set('disabled', true);
}
 
else {
        $$('#atividades___progrid_atv_0').set('readonly', false);
    $('#atividades___atv_1  (????) .set('disabled', false);
}


where:
atv_0 is working correctly (plugin=field)
atv_1 is not working (plugin=dropdown)

[]'s
Ana
 
Hello again,

Anyone knows how to write the syntax below inside the second one? In other words, how can I put both together?


Code:
('option:not(:checked)')


Code:
$$('#atividades___element1').set('disabled', true);

Thank you,
Ana
 
Eu sou brasileira e n?o desisto nunca! :)


LOAD and CHANGE

Code:
if ($$('#atividades___acordo_guru input[name=atividades___acordo_guru[]]:checked').get('value') == 'validado') {
 
 
$$('#atividades___element1 option:not(:selected)').set('disabled', true);
}
 
else {
 
$$('#atividades___element1 option:not(:selected)').set('disabled', false);
}


It's ok for dropdown (including database join and cascading) but it doesn't work in radio buttons.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top