![]() |
#1 |
Member
Join Date: Nov 2015
Posts: 96
|
![]()
i am trying to verify if an input field has at least X number of characters in it,
i need to replace this line in the script below this line ${CheckUserEmailAddress} "$1" "$R1" with an input string length check; instead of email check i have for for the second field (its not a password field!) after the email is verified; i just need to verify the next field has at least 8 characters before moving on to the next check, any advice? TIA Chris PHP Code:
|
![]() |
![]() |
![]() |
#2 |
Major Dude
Join Date: May 2005
Location: New Zealand
Posts: 916
|
http://nsis.sourceforge.net/Docs/Chapter4.html#StrLen.
http://nsis.sourceforge.net/Docs/Chapter4.html#intcmp. "Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me) NSIS 3 POSIX Ninja Wiki Profile |
![]() |
![]() |
![]() |
#3 |
Member
Join Date: Nov 2015
Posts: 96
|
Thank you Jason,
i saw that earlier; i couldn't figure how to incorporate it with length check, i wasn't sure if its the right way about this; ill give it another go, ATB Chris |
![]() |
![]() |
![]() |
#4 |
Major Dude
Join Date: May 2005
Location: New Zealand
Posts: 916
|
I edited my post, you need IntCmp to do the actual length check.
"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me) NSIS 3 POSIX Ninja Wiki Profile |
![]() |
![]() |
![]() |
#5 |
Member
Join Date: Nov 2015
Posts: 96
|
Thank you Jason
![]() what am i missing here? PHP Code:
|
![]() |
![]() |
![]() |
#6 |
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,452
|
Why do Pop $R1 ? The length is in $1 !
IntOp $PostCount $PostCount + 1 |
![]() |
![]() |
![]() |
#7 |
Member
Join Date: Nov 2015
Posts: 96
|
in this way it all pass valid blindly
PHP Code:
|
![]() |
![]() |
![]() |
#8 |
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,452
|
Nobody told you to pop at all. The result is stored directly in the variable!
IntOp $PostCount $PostCount + 1 |
![]() |
![]() |
![]() |
#9 |
Member
Join Date: Nov 2015
Posts: 96
|
even without the Pop; its still a no go for me
![]() |
![]() |
![]() |
![]() |
#10 |
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,452
|
After 'StrLen $1 "11111111"' $1 is always going to be 8. You are retrieving the text with ${NSD_GetText} and then throw away this text on the next line when it is overwritten by the result of StrLen. The syntax of StrLen is: StrLen $Output "Input", if you cannot understand this basic instruction then you might want to take a look at other installers like Inno Setup with less focus on pure scripting...
IntOp $PostCount $PostCount + 1 |
![]() |
![]() |
![]() |
#11 |
Member
Join Date: Nov 2015
Posts: 96
|
![]()
Thank you Andres,
that is exactly what i was seeing earlier; i was always getting 8 for result, i had to walk away for a bit as i was getting frustrated with this not working for me; but... after rebooting my system i finally got it right ![]() PHP Code:
it is challenging; but i am learning, you and Jason been great resource throughout this learning curve, ATB Chris |
![]() |
![]() |
![]() |
#12 |
Major Dude
Join Date: May 2005
Location: New Zealand
Posts: 916
|
You can optimize this even more by removing the second StrLen:
PHP Code:
"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me) NSIS 3 POSIX Ninja Wiki Profile |
![]() |
![]() |
![]() |
#13 |
Member
Join Date: Nov 2015
Posts: 96
|
![]()
Nice!
![]() |
![]() |
![]() |
![]() |
#14 |
Member
Join Date: Nov 2015
Posts: 96
|
quick question,
my nsDialogs seem to get stuck after submit comes with error, (from incorrect email address or something expected) the dialog input becomes locked for editing; i have to go back a page then forward again; why is that? am i missing a refresh or something? TIA Chris |
![]() |
![]() |
![]() |
#15 |
Major Dude
Join Date: May 2005
Location: New Zealand
Posts: 916
|
Really? See if this works for you (it works for me):
PHP Code:
PHP Code:
"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me) NSIS 3 POSIX Ninja Wiki Profile |
![]() |
![]() |
![]() |
#16 |
Member
Join Date: Nov 2015
Posts: 96
|
Thank Jason
![]() points taken! the code you posted works ok for me too; the issue i believe is with next step i have in the function, i send the input out; if it passes your off to the next page; if response comes back invalid; the input become locked, PHP Code:
i think i need to sent it back to the previous page after failure; but thats on page create; and this is on page leave, i have nothing on leave page to restart the loop from again, |
![]() |
![]() |
![]() |
#17 |
Major Dude
Join Date: May 2005
Location: New Zealand
Posts: 916
|
So which function is that code in? It's unwise to use abort within a Create function. Putting up the leave function and the next page's create function will help greatly.
"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me) NSIS 3 POSIX Ninja Wiki Profile |
![]() |
![]() |
![]() |
#18 |
Member
Join Date: Nov 2015
Posts: 96
|
Thank you very much Jason,
that bit is the second part of - on page leave, its not on page create; i take the email input and code; then submit it for verification online, the return token is then compared for false positive with that bit; all still within page leave function, the abort is there to end the loop and go again if the local basic input check fails, ATB Chris |
![]() |
![]() |
![]() |
#19 |
Major Dude
Join Date: May 2005
Location: New Zealand
Posts: 916
|
Ok, you will have to do some troubleshooting. Start commenting out commands one at a time until it works, then start uncommenting them one at a time until it fails. This will lead to the command that's causing it to fail. Once you can control a failure, then you can find a solution to it.
"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me) NSIS 3 POSIX Ninja Wiki Profile |
![]() |
![]() |
![]() |
#20 |
Member
Join Date: Nov 2015
Posts: 96
|
i know where the issue is; its with continue: -> Abort
instead of aborting i need it to goto the start again; but aborting there doesn't send me to start because im already on page leave instructions, |
![]() |
![]() |
![]() |
#21 |
Member
Join Date: Nov 2015
Posts: 96
|
well...
i worked it out with RelGotoPage ![]() |
![]() |
![]() |
![]() |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|