Issue when using alert within a function | rita alves | 2019-10-28 04:21 | |||||||||
Status: Closed | |||||||||||
Hello I have the following questions within a survey design code: {"name" : "inidt", caption" : "Data de início:", "xtype": "datefield"}, {"extConfig":{ "fieldLabel": "Descontinuação?", "xtype":"radiogroup", "name":"discquestion", "columns":1, "items":[ {"boxLabel":"Sim", "name":"disc", "inputValue": 1}, {"boxLabel":"Não", "name":"disc", "inputValue": 0}, {"boxLabel":"Desconhecido", "name":"disc", "inputValue": "NA"}]}}, {"extConfig":{ "name" : "discdt", "fieldLabel" : "Data de descontinuação:", "xtype": "datefield", "hidden": true}, "listeners": { "change": { "question": "discquestion", "fn" : "function(me, cmp, newValue, oldValue){var cmp2 = cmp.getValue(); if (cmp2.disc == 1) {me.setVisible(newValue); console.log(cmp2.disc);} else {me.setVisible(false);}} "}}}, {"extConfig": {"name" : "obs", "caption" : " ", "xtype": "textareafield", "grow" : true, "width": 800, "height": 200}, "listeners": { "change": { "question": ["discdt","inidt"], "fn" : "function(me, cmp, newValue, oldValue){var q1 = cmp.getName(); var q2 = cmp.getName(); if (q1 == 'inidt'){q1val = newValue; console.log(newValue);} else if (q2 == 'discdt'){q2val = newValue; console.log(newValue);}; if (q1val>=q2val){alert('nooooooo')};}; console.log(newValue); "}}} I was trying to make question "discdt" visible only if disc = 1 (this is working). Although I would like to add a validation of the dates: discdt has to be more recent than inidt. This is working if i am creating a new survey. Howerver when I try to access a saved/submitted survey it is just "loading" (this is a problem cause I need to access the surveys after they are filled). Could you please help? Thank you! |
|||||||||||
| |||||||||||