Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

mark red just specific cells Array text

  • brais24
  • brais24's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
1 month 1 day ago #259025 by brais24
Please help us help you and fill where relevant:
Your LimeSurvey version: 5.6.49+231212
Own server or LimeSurvey hosting: Own
Survey theme/template: Vanilla
==================
Hi there, i have a question that i try to do but i wont be able to do completely.

I have the question that you can see on the attached image and you have the survey on the lss.
 

What i want to do for each row is:
If you insert a number on one of the black surrounded cells, the red surrounded cell should be marked in red and a message should appear, (the message is not a problem) and, when you insert a quantity on the red cell, that red mark should dissapear.

I try to do it on the subquestion equation question:
(is_empty(M1_SQ001_SQ003) or regexMatch('/^$/',M1_SQ001_SQ003))

With this on question help:
{if((is_empty(M1_SQ001_SQ003) or regexMatch('/^$/', M1_SQ001_SQ003)), '', 'Por favor, inserte un dato en gasto total en M1.<br />')}

It is possible to do this? Ive been searching for info on the forum and in some say that this is just possible with javascript.

Thanks for the help.

Please Log in to join the conversation.

  • brais24
  • brais24's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
4 weeks 2 days ago #259103 by brais24
Replied by brais24 on topic mark red just specific cells Array text
Hi there, i have a little update, i be able to do what i want with 2 of the cells, when i insert a value on the second cell of the first row, an alert popup saying that you have to insert something on the first cell of the first row, like you can see here.
 

And when you insert something on the first cell of the first row, the message dissapear as you can see.
 

I be able to do it using this code on ecuation validation question:
((is_empty(M1_Y001_X003.NAOK)) or (!is_empty(M1_Y001_X003.NAOK) and (!is_empty(M1_Y001_X001.NAOK))))

And this on help about validation question:
{if((((is_empty(M1_Y001_X003.NAOK)) or (!is_empty(M1_Y001_X003.NAOK) and (!is_empty(M1_Y001_X001.NAOK))))), '', 'Por favor, introduzca algo en gasto total M1.<br />')}

Now i have to do the same with the other 4 cells on the same row, and then do the same but in other way, if you insert a value on the first cell, should appear a message saying that you have to insert a value on the last 3 cells.

¿Can someone help me to do this?

I try to add the 3rd cell (Wich is the 4th by code) with this on validation question and help about validation question, but dont work, I think it's because of the nested validations.

(((is_empty(M1_Y001_X003.NAOK)) or (is_empty(M1_Y001_X004.NAOK))) or ((!is_empty(M1_Y001_X003.NAOK) or !is_empty(M1_Y001_X004.NAOK)) and (!is_empty(M1_Y001_X001.NAOK))))

{if(((((is_empty(M1_Y001_X003.NAOK)) or (is_empty(M1_Y001_X004.NAOK))) or 
((!is_empty(M1_Y001_X003.NAOK) or !is_empty(M1_Y001_X004.NAOK)) and (!is_empty(M1_Y001_X001.NAOK))))), '', 'Por favor, introduzca algo en descripción de los programas.<br />')}

I attach the lss again with the code too.
 

File Attachment:

File Name: limesurvey...3-27.lss
File Size:40 KB


In advance, thanks for the help.

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 weeks 2 days ago #259122 by tpartner
Replied by tpartner on topic mark red just specific cells Array text
It seems to me that according to your mock-up above, the question validation equation should be:

Code:
(
    is_empty(M1_Y001_X003.NAOK) 
    OR 
    !is_empty(M1_Y001_X001.NAOK)
)
AND
(
    is_empty(M1_Y001_X004.NAOK) 
    OR 
    !is_empty(M1_Y001_X001.NAOK)
)
AND
(
    is_empty(M1_Y001_X005.NAOK) 
    OR 
    !is_empty(M1_Y001_X001.NAOK)
)
AND
(
    is_empty(M1_Y001_X006.NAOK) 
    OR 
    !is_empty(M1_Y001_X001.NAOK)
)
AND
(
    is_empty(M1_Y001_X007.NAOK) 
    OR 
    !is_empty(M1_Y001_X001.NAOK)
)
AND
(
    is_empty(M1_Y004_X001.NAOK) 
    OR 
    (
        !is_empty(M1_Y004_X008.NAOK)
        AND
        !is_empty(M1_Y004_X009.NAOK)
        AND
        !is_empty(M1_Y004_X010.NAOK)
    )
)

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

  • brais24
  • brais24's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
3 weeks 3 days ago #259658 by brais24
Replied by brais24 on topic mark red just specific cells Array text
Seems like it works, i have to modify a little bit with the ANDS and ORS but it works, i let the code over here.

Ecuation validation question:
(is_empty(M1_Y001_X003.NAOK)OR!is_empty(M1_Y001_X001.NAOK))AND(is_empty(M1_Y001_X004.NAOK)OR!is_empty(M1_Y001_X001.NAOK))AND(is_empty(M1_Y001_X005.NAOK)OR!is_empty(M1_Y001_X001.NAOK))AND(is_empty(M1_Y001_X006.NAOK)OR!is_empty(M1_Y001_X001.NAOK))AND(is_empty(M1_Y001_X007.NAOK)OR!is_empty(M1_Y001_X001.NAOK))AND(is_empty(M1_Y001_X001.NAOK)OR(!is_empty(M1_Y001_X008.NAOK)OR!is_empty(M1_Y001_X009.NAOK)OR!is_empty(M1_Y001_X010.NAOK)))

Help about validation question:
{if(((is_empty(M1_Y001_X003.NAOK)OR!is_empty(M1_Y001_X001.NAOK))AND(is_empty(M1_Y001_X004.NAOK)OR!is_empty(M1_Y001_X001.NAOK))AND(is_empty(M1_Y001_X005.NAOK)OR!is_empty(M1_Y001_X001.NAOK))AND(is_empty(M1_Y001_X006.NAOK)OR!is_empty(M1_Y001_X001.NAOK))), '', 'Por favor, introduzca algo en gasto total M1.<br />')}


{if(((is_empty(M1_Y001_X001.NAOK)OR(!is_empty(M1_Y001_X008.NAOK)OR!is_empty(M1_Y001_X009.NAOK)OR!is_empty(M1_Y001_X010.NAOK)))), '', 'Por favor, introduzca Entradas/salidas/stock.<br />')}

I have 2 sentences on the ecuation validation question because i want a different message if you put a value in one cell or in another.

If i have more issues or other this to add i let you know.

Thanks for the help.

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose