Hi to everyone,
I can’t solve a problem and I think I’m running around uselessly.
I therefore need your help. I have to show a field only if another text field is visible.
Can you help me?
I write here my code which for now does not work.
Thanks in advance as always
export function BottoneA_click(event) {
//“Error1” is a text field
if ($w(“#Error1”).show()) { // this is the promise that doesn’t work
$w(“#Boxnext”).hide()
} **else if** ($w("#Error1").hide) { // this is the second promise that already doesn't work
$w("#Boxnext").show();
}
}
Hi @deleteduser
First of all “visible” does not exist, at most it “isVisible” and in any case it does not work because it is used to define a variable and not to verify a condition.
Any other suggestions, please?
Hi @deleteduser
if I write how much you suggest me it marks an error on the first line because it says that “hidden is a member but used as a function.
if (!$w(”#Error1").hidden()) { // this is wrong
Other suggestions?
@deleteduser
nothing, completely skips the condition either
$w (“# Error1”) is visible or not.
The code that has been suggested to me does not work and, instead it has compilations errors.
Does anyone else have suggestions for how to fix or correct my initial code?
Thanks in advance as always
Yes it does work, it would have simply shown you an error on that line and all you have to do was to remove the extra parentheses at the end of hidden.
$w.onReady(function () {
});
export function BottoneA_click(event) {
if (!$w("#Error1").hidden) {
$w("#Boxnext").hide()
}
if ($w("#Error1").hidden) {
$w("#Boxnext").show();
}
}
If #Error is showing on the page when the button is clicked, #Boxnet will be hidden.
If both #Error and #Boxnet are set up as hidden on load, then when button is clicked #Boxnet will be shown.