Display what fields a user missed in an answer box?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Posts: 14
- Joined: Sun Dec 30, 2018 11:16 pm
Display what fields a user missed in an answer box?
Hi,
What is the best way to display what fields a user missed when they press the submit button.
I have 4 fields that I would like a user to fill it.
If they hit the submit button and have not filled in all the fields an answer box pops up saying please fill in the empty fields above.
Thank you
What is the best way to display what fields a user missed when they press the submit button.
I have 4 fields that I would like a user to fill it.
If they hit the submit button and have not filled in all the fields an answer box pops up saying please fill in the empty fields above.
Thank you
-
- Livecode Opensource Backer
- Posts: 9375
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Display what fields a user missed in an answer box?
- Attachments
-
- Field Filler.livecode.zip
- Here's the stack
- (1.25 KiB) Downloaded 195 times
-
- Posts: 14
- Joined: Sun Dec 30, 2018 11:16 pm
Re: Display what fields a user missed in an answer box?
Hi Richmond,
Thank you for pointing me in the right direction.
Based on what you built I came up with the following.
Thank you for pointing me in the right direction.
Based on what you built I came up with the following.
-
- Livecode Opensource Backer
- Posts: 9375
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Display what fields a user missed in an answer box?
I'm afraid that yours is a bit problematic insofar as it only notifies us
that ONE field has not been filled.
-
- Posts: 14
- Joined: Sun Dec 30, 2018 11:16 pm
Re: Display what fields a user missed in an answer box?
For what I am doing that would be ok.
But is it possible to loop through and add the missing fields to an array then display the array values in the answer dialogue box?
Thank you
But is it possible to loop through and add the missing fields to an array then display the array values in the answer dialogue box?
Thank you
-
- Livecode Opensource Backer
- Posts: 9375
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Display what fields a user missed in an answer box?
Probably, but I don't know as I am only a simple fellow.is it possible
Re: Display what fields a user missed in an answer box?
Yes, you can do whatever you like, but there's no need for an array.
Loop through, yes.
Build a list of fields requiring completion, yes. (List being one variable, each iteration of the loop appending a missing field if appropriate.)
Answer the variable, giving the whole list.
Richmond already demonstrated that. Simple describes his code rather than his intellect.
Loop through, yes.
Build a list of fields requiring completion, yes. (List being one variable, each iteration of the loop appending a missing field if appropriate.)
Answer the variable, giving the whole list.
Richmond already demonstrated that. Simple describes his code rather than his intellect.
-
- Posts: 14
- Joined: Sun Dec 30, 2018 11:16 pm
Re: Display what fields a user missed in an answer box?
Hi everyone,
Thanks for all of your help.
Here is what I ended up with.
Thank you
Thanks for all of your help.
Here is what I ended up with.
Thank you
-
- VIP Livecode Opensource Backer
- Posts: 9655
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Display what fields a user missed in an answer box?
So much fun.
Put this into your "Submit" button script:
You can always embellish this by giving the names of the empty fields instead of merely their number.
Craig Newman
Put this into your "Submit" button script:
Code: Select all
on mouseUp
repeat with z = 1 to 4
if fld z = "" then put z & return after accum
if accum <> "" then answer "The following fields require data:" & return & return & accum
end repeat
end mouseUp
Craig Newman
Re: Display what fields a user missed in an answer box?
Or rather:
Code: Select all
on mouseUp
repeat with z = 1 to 4
if fld z = "" then put z & return after accum
end repeat
if accum <> "" then answer "The following fields require data:" & return & return & accum
end mouseUp
-
- VIP Livecode Opensource Backer
- Posts: 9655
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Display what fields a user missed in an answer box?
Klaus,
Are there invisible chars that set your script apart from mine?
Craig
Are there invisible chars that set your script apart from mine?
Craig
Re: Display what fields a user missed in an answer box?
I thought it would be a good idea to show the dialog after all fields have been inspected.
Not?
Not?
-
- Posts: 14
- Joined: Sun Dec 30, 2018 11:16 pm
Re: Display what fields a user missed in an answer box?
Wow, Thanks I am learning quite a bit!
Using accum makes things much cleaner than what I came up with.
Thank you
Using accum makes things much cleaner than what I came up with.
Thank you
-
- VIP Livecode Opensource Backer
- Posts: 9655
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Display what fields a user missed in an answer box?
Klaus.
You know, I used the test stack provided, which had only one field empty. So I both our handlers worked identically. You might say I did not test exhaustively.
Broadly, on the handlers' own merits, I must have missed HC 101.
Craig
You know, I used the test stack provided, which had only one field empty. So I both our handlers worked identically. You might say I did not test exhaustively.
Broadly, on the handlers' own merits, I must have missed HC 101.
Craig