mIRC Homepage
Posted By: TECO identifier $input - 12/06/20 10:36 PM
Hi
I need your help people. I want to put first one IF the input is not filled and the OK button is pressed, return the following input "you must fill in the field". I put it like this:

Code

 var %x = $$input(Enter an exclude in nick!ident@host format!,evu,Add)
 if (%x == $null) && (%x != $false) { return $input(You need to fill in the field!,io,Info) }
 elseif (*!*@* !iswm %x) { errdialog You have to enter an exclude in nick!ident@host format! }
 elseif ($hget(pexclude,%x)) { errdialog You already added this exclude! }


But I do not want that when the Cancel button is pressed the input appears and I am not getting it.

Is there a way to solve it?
Posted By: Wims Re: identifier $input - 12/06/20 10:59 PM
Use the 'f' switch, if ok is pressed, you'll get the content as usual, but if cancel or no is pressed, you'll get $cancel or $no (plain text)
Posted By: maroon Re: identifier $input - 13/06/20 05:16 AM
It appears the 'v' switch has no effect in combo with the 'e' switch. I can't get there to be any difference in clicking with an empty editbox on yes/no/cancel:

//echo -a $input(test,evn)

I dunno if that's 'by design' or something that could be added by a feature request. Obviously there's no reason for the 'yes' button to return $true when there's an editbox, but there could be use cases where clicking on no or cancel would behave the same as if typing $false or $cancel into the editbox then clicking yes.

But also, in your example you're using the double dollar, so that's going to halt rather than setting %x to null.
Posted By: TECO Re: identifier $input - 13/06/20 08:59 AM
I understand what you mean, but in the context I want, I only want to have an input with just two buttons. OK and Cancel. So thanks anyway.
Posted By: TECO Re: identifier $input - 13/06/20 08:59 PM
I found the solution wink

Thanks Wims for the tip.

Code
 var %x = $input(Enter an exclude in nick!ident@host format!,euf,Add)
 if (%x == $null) && (%x != $false) { return $input(You have to fill out editbox!,iuo,Info) }
 elseif (%x == $false) { $null }
 elseif (*!*@* !iswm %x) { errdialog You have to enter an exclude in nick!ident@host format! }
 elseif ($hget(pexclude,%x)) { errdialog You already added this exclude! }
 else {
    hadd pexclude %x 1
    hsave -ob pexclude $_tabdir(pexclude.tbl)
    did -a $dname 2 %x
    did -e $dname 6
  }
© mIRC Discussion Forums