How can i make a check on empty fields in a form with a pop-

You have completed your first interactive designs with QuarkXPress 7, 8 & 9 and now have need for more advanced functionality. Discuss Expressions here, ask questions and learn more about them.
Please note that Flash (SWF) authoring is not supported in QuarkXPress 10 anymore.
Frans van Huizen
Posts: 0
Joined: 12 Jul 2009, 09:16

How can i make a check on empty fields in a form with a pop-

Post by Frans van Huizen » 12 Jul 2009, 20:45

Hello,Does someone know how i can make a form (e-mailform) with fields that have to be filled in.So if someone leaves the field empy and pushes the submit button a warning pop-up with a message.I'll like to use it on my website on the e-mailform.This is the link to it.http://digital2solutions.nlWIth Kind regards, from Holland

Matthias Guenther (Quark)
Quarkian
Quarkian
Posts: 2490
Joined: 04 Jun 2004, 15:06
Contact:

How can i make a check on empty fields in a form with a pop-

Post by Matthias Guenther (Quark) » 12 Jul 2009, 21:04

Hoi, Frans,
yes, with Interactive layout you can make a form (in SWF, so Flash) that has text fields and you can check the validity of the fields and onyl then fire it off to a web server.
Is a Flash form what you are looking for?
Groetjes
Matthias

Matthias Guenther (Quark)
Quarkian
Quarkian
Posts: 2490
Joined: 04 Jun 2004, 15:06
Contact:

How can i make a check on empty fields in a form with a pop-

Post by Matthias Guenther (Quark) » 14 Jul 2009, 19:18

Hi, Frans,
Frans van Huizen wrote:Maybe you have a pre-confired sample ( if a field is empty a message alert)

It is actually quite easy, if you just want to look for "not empty". It gets a bit more difficult if you want to check for valid email address or so.
Not empty check:
Prerequisiste: An editable text box (named datafield) and a submit button.
When you press the submit button, run the following check (script):
Control > If Expression datafield.GetText() == ""
(beep, display error message etc.)
Control > End If
And you are done!
Best
Matthias

jayntree
Posts: 0
Joined: 10 Aug 2011, 11:05

How can i make a check on empty fields in a form with a pop-

Post by jayntree » 10 Aug 2011, 23:00

Hi Matthias,

How would this apply to a drop down menu option?
If the first option is "Please Select:" and I want the script to stop if the field contains "Please Select:" (i.e. no option has been selected)

I have used this expression in my script
...
Sector.GetText()="Please Select:" - Check that the field does not contain "Please Select:"

Show Object "sectorrequired"- show a text box which says "required field"
Stop Script "Datasubmit"
End If
...

but it does not work.
Any advice??

Matthias Guenther (Quark)
Quarkian
Quarkian
Posts: 2490
Joined: 04 Jun 2004, 15:06
Contact:

How can i make a check on empty fields in a form with a pop-

Post by Matthias Guenther (Quark) » 11 Aug 2011, 22:32

Hi jayntree,
"Stop Script" probably is the wrong method, unless the other script is already running.
Can you please let me know a bit more about the two scripts you are using so that I can comment on this?

Thanks
Matthias

jayntree
Posts: 0
Joined: 10 Aug 2011, 11:05

How can i make a check on empty fields in a form with a pop-

Post by jayntree » 11 Aug 2011, 22:58

Hi Matthias,
The 'Stop Script' action is being used to stop this script. Therefore, once the submit button is pressed, it activates this script and if one of the 'required' fields is left blank, it shows a'required' text box object and stops the script from continuing.
The script works great for Manual Text boxes - it should do, I borrowed it from one of YOUR excellent tutorials[:)] but it does not work for a drop-down form box.
What I need it to do is...
I have a form, most of the boxes are text boxes, but 2 of the 'required' fields are drop down menu boxes. These boxes (for clarity) have the first menu item as "Please Select:" So I assumed that the script would simply GetText from that box and if it still said "Please Select:" then it would stop running the script, until another option was chosen.
Hope this maks more sense, I'm still learning scripting and explaining it is, at present, not very easy!!
Thanks
Jamie

Matthias Guenther (Quark)
Quarkian
Quarkian
Posts: 2490
Joined: 04 Jun 2004, 15:06
Contact:

How can i make a check on empty fields in a form with a pop-

Post by Matthias Guenther (Quark) » 11 Aug 2011, 23:33

Hi Jamie,
now I understand.
I am not sure that a Popup menu is a textbox. And you seem to miss an IF statement.

You could fix it this way: Create another text box for yourpopup menu, called "Field1checker" or whatever.
Then your script should be:
Hide "Warning box"
"Popup > Get Selection", "Your menu", "Item Name", "Field1checker", "Replace All".
If Field1checker.GetText == "Please Select..."
Show "Warning box"
End Script "this"
EndIf
If Field1checker.GetText == ""
Show "Warning box"
End Script "this"
EndIf
Does that work?
Thanks
Matthias

jayntree
Posts: 0
Joined: 10 Aug 2011, 11:05

How can i make a check on empty fields in a form with a pop-

Post by jayntree » 12 Aug 2011, 01:03

Absolutely Brilliant,
I'd never noticed the 'Get Popup Menu Selection' action. That is a godsend -I assume that can be used, in some way, to create a "Thank You, [firstname] [lastname]" confirmation box. I'll try that next...
I did have to amend your script slightly by replacing '=' with '==' in both 'If' lines (don't know the difference but I know it works!!)
Many, Many Thanks,
Your help today has been fantastic.
Jamie
(If your interested the website is http://www.swiftuk.co.uk/tradeshow)

Matthias Guenther (Quark)
Quarkian
Quarkian
Posts: 2490
Joined: 04 Jun 2004, 15:06
Contact:

How can i make a check on empty fields in a form with a pop-

Post by Matthias Guenther (Quark) » 12 Aug 2011, 01:05

Hi Jamie,
jayntree wrote:I did have to amend your script slightly by replacing '=' with '==' in both 'If' lines (don't know the difference but I know it works!!)

Of course. How embarrassing, I even held a seminar about this once. Thanks for catching that, I just used my (aging? ;-) memory.
Regards
Matthias

jayntree
Posts: 0
Joined: 10 Aug 2011, 11:05

How can i make a check on empty fields in a form with a pop-

Post by jayntree » 12 Aug 2011, 01:07

e-Seminar8 by any chance!!![:D]

Locked

Return to “Expressions”