Re: [WebDNA] Require no empty field

This WebDNA talk-list message is from

2010


It keeps the original formatting.
numero = 105848
interpreted = N
texte = --Apple-Mail-1-396253132 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Sure Li, lots of people here can help, and several of them would be glad to help. Like me. Lawrence also just posted an answer to you, but (without actually reading the link/suggestion he gave you), I assume that uses javascript and one should never rely on javascript alone for form validation. Some people (and machines) do not use javascript. Whatever you do or do not do for form validation on the client side (like with javascript) you also need to back up with server side code (like webdna). Can you post a simplified version of your form, and the file you post to, so we can see the source code that needs to be worked with? I like to use a reusable webdna library for form validation so I do not have to rewrite my validation routine every time I need it for a new form. I am happy to share my validation library code with you, but if you are starting from scratch (i.e. this is your first time), then maybe you would learn best by just seeing how it might be done, very simply, just for your current need. "Psuedo code" is when we describe in plain language what we want our code to do. So in psuedo code, what you need might go something like this: 1) form page ("form") posts to itself, which makes it be in 'receiver- page-mode' ("reciever") 2) "receiver" checks to see if any of the required fields are "blank" (equal to a string of characters which is zero characters in length) - if any of those required fields are blank, then display the "form" with the data already input, but also now a message to user to complete everything as required. - if none of the required fields are blank, then user correctly filled out the form, and so take action (send email to admin person). That, in real code, might look something like this: -------------------------------------------------------------------------------------------------------------------------------------------- [text show=F]alertUserHisMistake=[/text] [if ("[URL][formWasSubmitted][/URL]"="T")] [then] [!]---this is 'receiver-page-mode'---[/!] [text show=F]usersNameIsRequired=[RemoveHTML][usersNameIsRequired][/ RemoveHTML][/text] [text show=F]emalIsRequired=[RemoveHTML][emalIsRequired][/RemoveHTML] [/text] [text show=F]thisFieldNOTrequired=[RemoveHTML][thisFieldNOTrequired] [/RemoveHTML][/text] [showif [URL][usersNameIsRequired][/URL]=] [text show=F]alertUserHisMistake=[alertUserHisMistake]the 'usersNameIsRequired' field is required.
[/text] [/showif] [showif [URL][emalIsRequired][/URL]=] [text show=F]alertUserHisMistake=[alertUserHisMistake]the 'emalIsRequired' field is required.
[/text] [/showif] [!]---if no user errors, then send the email---[/!] [showif [URL][alertUserHisMistake][/URL]=] [!]---[alertUserHisMistake] is still blank, so user committed no errors; so now send email.---[/!] [sendmail to=[yourAdminAddress]&from=[URL][emalIsRequired][/ URL]&subject=someSubject] the user said this: usersNameIsRequired=[usersNameIsRequired] emalIsRequired=[emalIsRequired] thisFieldNOTrequired=[thisFieldNOTrequired] [/sendmail] [/showif] [/then] [else] [!]---user has not yet submitted the form, initialize the form fields to blank.---[/!] [text show=F]usersNameIsRequired=[/text] [text show=F]emalIsRequired=[/text] [text show=F]thisFieldNOTrequired=[/text] [/else] [/if]  Untitled [showif [URL][alertUserHisMistake][/URL]!] 

[alertUserHisMistake] 

[/showif] 
usersNameIsRequired=
emalIsRequired=
thisFieldNOTrequired=
  
-------------------------------------------------------------------------------------------------------------------------------------------- put that on your server and play with it to get a feeling how it works. The next step will be to validate the email address so it must look like a real email address. Like what if the user enters something but it is not a valid address? -Govinda On Sep 29, 2010, at 4:07 PM, Li Yang wrote: > > Is anybody can help me out with a code that require no empty field > in my form? > I have a form that I want to make customer filled with their > information. there are two fields that I wish they will not leave > them as empty field because we need to collecting their email > address and name to contact them back. > > thanks for your help! --Apple-Mail-1-396253132 Content-Type: text/html; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Sure Li, lots of people here = can help, and several of them would be glad to help.  Like = me.

Lawrence also just posted an answer to you, but = (without actually reading the link/suggestion he gave you), I assume = that uses javascript and one should never rely on javascript alone for = form validation.  Some people (and machines) do not use javascript. =  Whatever you do or do not do for form validation on the client = side (like with javascript) you also need to back up with server side = code (like webdna).

Can you post a simplified = version of your form, and the file you post to, so we can see the source = code that needs to be worked with?

I like to = use a reusable webdna library for form validation so I do not have to = rewrite my validation routine every time I need it for a new form. I am = happy to share my validation library code with you, but if you = are starting from scratch (i.e. this is your first time), then maybe you = would learn best by just seeing how it might be done, very simply, just = for your current need.

"Psuedo code" is when we = describe in plain language what we want our code to do.  So in = psuedo code, what you need might go something like = this:

1) form page ("form") posts to itself, = which makes it be in 'receiver-page-mode' ("reciever")
2) = "receiver" checks to see if any of the required fields are "blank" = (equal to a string of characters which is zero characters in = length)
- if any of those required fields = are blank, then display the "form" with the data already input, but also = now a message to user to complete everything as = required.
- if none of the required fields = are blank, then user correctly filled out the form, and so take action = (send email to admin person).

That, in real = code, might look something like = this:

-------------------------------------------= --------------------------------------------------------------------------= -----------------------
<!DOCTYPE HTML PUBLIC = "-//W3C//DTD HTML 4.01 Transitional//EN"
     =    "http://www.w3.org/TR/html4/l= oose.dtd">
<html = lang=3D"en">

[text = show=3DF]alertUserHisMistake=3D[/text]

[if = ("[URL][formWasSubmitted][/URL]"=3D"T")]
= [then]
[!]---this is = 'receiver-page-mode'---[/!]
[text = show=3DF]usersNameIsRequired=3D[RemoveHTML][usersNameIsRequired][/RemoveHT= ML][/text]
[text = show=3DF]emalIsRequired=3D[RemoveHTML][emalIsRequired][/RemoveHTML][/text]=
= [text = show=3DF]thisFieldNOTrequired=3D[RemoveHTML][thisFieldNOTrequired][/Remove= HTML][/text]

[showif = [URL][usersNameIsRequired][/URL]=3D]
= [text show=3DF]alertUserHisMistake=3D[alertUserHisMistake]the = 'usersNameIsRequired' field is = required.<br>[/text]
[/showif]
= [showif [URL][emalIsRequired][/URL]=3D]
= [text show=3DF]alertUserHisMistake=3D[alertUserHisMistake]the = 'emalIsRequired' field is required.<br>[/text]
= [/showif]

[!]---if no user errors, = then send the email---[/!]
[showif = [URL][alertUserHisMistake][/URL]=3D]
= [!]---[alertUserHisMistake] is still blank, so user committed no = errors; so now send email.---[/!]
[sendmail = to=3D[yourAdminAddress]&from=3D[URL][emalIsRequired][/URL]&subject= =3DsomeSubject]
the user = said this:
= usersNameIsRequired=3D[usersNameIsRequired]
= emalIsRequired=3D[emalIsRequired]
= thisFieldNOTrequired=3D[thisFieldNOTrequired]
= [/sendmail]
= [/showif]

[/then]
= [else]
[!]---user has not yet = submitted the form, initialize the form fields to = blank.---[/!]
[text = show=3DF]usersNameIsRequired=3D[/text]
= [text show=3DF]emalIsRequired=3D[/text]
= [text show=3DF]thisFieldNOTrequired=3D[/text]
= [/else]
[/if]

<head>
=
= <meta http-equiv=3D"content-type" content=3D"text/html; = charset=3Dutf-8">
= <title>Untitled</title>
</head>
<body>
[showif = [URL][alertUserHisMistake][/URL]!]
= <p style=3D"color:red;">
= [alertUserHisMistake]
= </p>
= [/showif]

<form action=3D"[thisurl]" = method=3D"post">
= usersNameIsRequired=3D<input name=3D"usersNameIsRequired" = type=3D"text" = value=3D"[input][usersNameIsRequired][/input]"><br>
= emalIsRequired=3D<input name=3D"emalIsRequired" type=3D"text" = value=3D"[input][emalIsRequired][/input]"><br>
= thisFieldNOTrequired=3D<input name=3D"thisFieldNOTrequired" = type=3D"text" = value=3D"[input][thisFieldNOTrequired][/input]"><br>
= <input name=3D"formWasSubmitted" type=3D"hidden" = value=3D"T">
<input name=3D"go" = type=3D"submit" value=3D"go!">
= </form>
</body>
</html>
=
----------------------------------------------------------= --------------------------------------------------------------------------= --------

put that on your server and play = with it to get a feeling how it works.  The next step will be to = validate the email address so it must look like a real email address. =  Like what if the user enters something but it is not a valid = address?

-Govinda


On Sep 29, 2010, at 4:07 PM, Li Yang wrote:


Is anybody = can help me out with a code that require no empty field in my = form?
I have a form that I want to make customer filled with = their information. there are two fields that I wish they will not = leave them as empty field because we need to collecting their email = address and name to contact them back.
 
=
thanks for your help!


= --Apple-Mail-1-396253132-- Associated Messages, from the most recent to the oldest:

    
  1. Re: [WebDNA] Require no empty field (Marc Thompson 2010)
  2. Re: [WebDNA] Require no empty field (Govinda 2010)
  3. Re: [WebDNA] Require no empty field (Govinda 2010)
  4. Re: [WebDNA] Require no empty field (sal danna 2010)
  5. Re: [WebDNA] Require no empty field ("Li Yang" 2010)
  6. Re: [WebDNA] Require no empty field (Lawrence 2010)
  7. [WebDNA] Require no empty field ("Li Yang" 2010)
--Apple-Mail-1-396253132 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Sure Li, lots of people here can help, and several of them would be glad to help. Like me. Lawrence also just posted an answer to you, but (without actually reading the link/suggestion he gave you), I assume that uses javascript and one should never rely on javascript alone for form validation. Some people (and machines) do not use javascript. Whatever you do or do not do for form validation on the client side (like with javascript) you also need to back up with server side code (like webdna). Can you post a simplified version of your form, and the file you post to, so we can see the source code that needs to be worked with? I like to use a reusable webdna library for form validation so I do not have to rewrite my validation routine every time I need it for a new form. I am happy to share my validation library code with you, but if you are starting from scratch (i.e. this is your first time), then maybe you would learn best by just seeing how it might be done, very simply, just for your current need. "Psuedo code" is when we describe in plain language what we want our code to do. So in psuedo code, what you need might go something like this: 1) form page ("form") posts to itself, which makes it be in 'receiver- page-mode' ("reciever") 2) "receiver" checks to see if any of the required fields are "blank" (equal to a string of characters which is zero characters in length) - if any of those required fields are blank, then display the "form" with the data already input, but also now a message to user to complete everything as required. - if none of the required fields are blank, then user correctly filled out the form, and so take action (send email to admin person). That, in real code, might look something like this: -------------------------------------------------------------------------------------------------------------------------------------------- [text show=F]alertUserHisMistake=[/text] [if ("[url][formWasSubmitted][/URL]"="T")] [then] [!]---this is 'receiver-page-mode'---[/!] [text show=F]usersNameIsRequired=[removehtml][usersNameIsRequired][/ RemoveHTML][/text] [text show=F]emalIsRequired=[removehtml][emalIsRequired][/RemoveHTML] [/text] [text show=F]thisFieldNOTrequired=[removehtml][thisFieldNOTrequired] [/RemoveHTML][/text] [showif [url][usersNameIsRequired][/URL]=] [text show=F]alertUserHisMistake=[alertUserHisMistake]the 'usersNameIsRequired' field is required.
[/text] [/showif] [showif [url][emalIsRequired][/URL]=] [text show=F]alertUserHisMistake=[alertUserHisMistake]the 'emalIsRequired' field is required.
[/text] [/showif] [!]---if no user errors, then send the email---[/!] [showif [url][alertUserHisMistake][/URL]=] [!]---[alertUserHisMistake] is still blank, so user committed no errors; so now send email.---[/!] [sendmail to=[yourAdminAddress]&from=[url][emalIsRequired][/ URL]&subject=someSubject] the user said this: usersNameIsRequired=[usersNameIsRequired] emalIsRequired=[emalIsRequired] thisFieldNOTrequired=[thisFieldNOTrequired] [/sendmail] [/showif] [/then] [else] [!]---user has not yet submitted the form, initialize the form fields to blank.---[/!] [text show=F]usersNameIsRequired=[/text] [text show=F]emalIsRequired=[/text] [text show=F]thisFieldNOTrequired=[/text] [/else] [/if]  Untitled [showif [url][alertUserHisMistake][/URL]!] 

[alertUserHisMistake] 

[/showif] 
[thisurl]" method="post"> usersNameIsRequired=[input][usersNameIsRequired][/input]">
emalIsRequired=[input][emalIsRequired][/input]">
thisFieldNOTrequired=[input][thisFieldNOTrequired][/input]">
  
-------------------------------------------------------------------------------------------------------------------------------------------- put that on your server and play with it to get a feeling how it works. The next step will be to validate the email address so it must look like a real email address. Like what if the user enters something but it is not a valid address? -Govinda On Sep 29, 2010, at 4:07 PM, Li Yang wrote: > > Is anybody can help me out with a code that require no empty field > in my form? > I have a form that I want to make customer filled with their > information. there are two fields that I wish they will not leave > them as empty field because we need to collecting their email > address and name to contact them back. > > thanks for your help! --Apple-Mail-1-396253132 Content-Type: text/html; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Sure Li, lots of people here = can help, and several of them would be glad to help.  Like = me.

Lawrence also just posted an answer to you, but = (without actually reading the link/suggestion he gave you), I assume = that uses javascript and one should never rely on javascript alone for = form validation.  Some people (and machines) do not use javascript. =  Whatever you do or do not do for form validation on the client = side (like with javascript) you also need to back up with server side = code (like webdna).

Can you post a simplified = version of your form, and the file you post to, so we can see the source = code that needs to be worked with?

I like to = use a reusable webdna library for form validation so I do not have to = rewrite my validation routine every time I need it for a new form. I am = happy to share my validation library code with you, but if you = are starting from scratch (i.e. this is your first time), then maybe you = would learn best by just seeing how it might be done, very simply, just = for your current need.

"Psuedo code" is when we = describe in plain language what we want our code to do.  So in = psuedo code, what you need might go something like = this:

1) form page ("form") posts to itself, = which makes it be in 'receiver-page-mode' ("reciever")
2) = "receiver" checks to see if any of the required fields are "blank" = (equal to a string of characters which is zero characters in = length)
- if any of those required fields = are blank, then display the "form" with the data already input, but also = now a message to user to complete everything as = required.
- if none of the required fields = are blank, then user correctly filled out the form, and so take action = (send email to admin person).

That, in real = code, might look something like = this:

-------------------------------------------= --------------------------------------------------------------------------= -----------------------
<!DOCTYPE HTML PUBLIC = "-//W3C//DTD HTML 4.01 Transitional//EN"
     =    "http://www.w3.org/TR/html4/l= oose.dtd">
<html = lang=3D"en">

[text = show=3DF]alertUserHisMistake=3D[/text]

[if = ("[url][formWasSubmitted][/URL]"=3D"T")]
= [then]
[!]---this is = 'receiver-page-mode'---[/!]
[text = show=3DF]usersNameIsRequired=3D[removehtml][usersNameIsRequired][/RemoveHT= ML][/text]
[text = show=3DF]emalIsRequired=3D[removehtml][emalIsRequired][/RemoveHTML][/text]=
= [text = show=3DF]thisFieldNOTrequired=3D[removehtml][thisFieldNOTrequired][/Remove= HTML][/text]

[showif = [url][usersNameIsRequired][/URL]=3D]
= [text show=3DF]alertUserHisMistake=3D[alertUserHisMistake]the = 'usersNameIsRequired' field is = required.<br>[/text]
[/showif]
= [showif [url][emalIsRequired][/URL]=3D]
= [text show=3DF]alertUserHisMistake=3D[alertUserHisMistake]the = 'emalIsRequired' field is required.<br>[/text]
= [/showif]

[!]---if no user errors, = then send the email---[/!]
[showif = [url][alertUserHisMistake][/URL]=3D]
= [!]---[alertUserHisMistake] is still blank, so user committed no = errors; so now send email.---[/!]
[sendmail = to=3D[yourAdminAddress]&from=3D[url][emalIsRequired][/URL]&subject= =3DsomeSubject]
the user = said this:
= usersNameIsRequired=3D[usersNameIsRequired]
= emalIsRequired=3D[emalIsRequired]
= thisFieldNOTrequired=3D[thisFieldNOTrequired]
= [/sendmail]
= [/showif]

[/then]
= [else]
[!]---user has not yet = submitted the form, initialize the form fields to = blank.---[/!]
[text = show=3DF]usersNameIsRequired=3D[/text]
= [text show=3DF]emalIsRequired=3D[/text]
= [text show=3DF]thisFieldNOTrequired=3D[/text]
= [/else]
[/if]

<head>
=
= <meta http-equiv=3D"content-type" content=3D"text/html; = charset=3Dutf-8">
= <title>Untitled</title>
</head>
<body>
[showif = [url][alertUserHisMistake][/URL]!]
= <p style=3D"color:red;">
= [alertUserHisMistake]
= </p>
= [/showif]

<form action=3D"[thisurl]" = method=3D"post">
= usersNameIsRequired=3D<input name=3D"usersNameIsRequired" = type=3D"text" = value=3D"[input][usersNameIsRequired][/input]"><br>
= emalIsRequired=3D<input name=3D"emalIsRequired" type=3D"text" = value=3D"[input][emalIsRequired][/input]"><br>
= thisFieldNOTrequired=3D<input name=3D"thisFieldNOTrequired" = type=3D"text" = value=3D"[input][thisFieldNOTrequired][/input]"><br>
= <input name=3D"formWasSubmitted" type=3D"hidden" = value=3D"T">
<input name=3D"go" = type=3D"submit" value=3D"go!">
= </form>
</body>
</html>
=
----------------------------------------------------------= --------------------------------------------------------------------------= --------

put that on your server and play = with it to get a feeling how it works.  The next step will be to = validate the email address so it must look like a real email address. =  Like what if the user enters something but it is not a valid = address?

-Govinda


On Sep 29, 2010, at 4:07 PM, Li Yang wrote:


Is anybody = can help me out with a code that require no empty field in my = form?
I have a form that I want to make customer filled with = their information. there are two fields that I wish they will not = leave them as empty field because we need to collecting their email = address and name to contact them back.
 
=
thanks for your help!


= --Apple-Mail-1-396253132-- Govinda

DOWNLOAD WEBDNA NOW!

Top Articles:

Talk List

The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...

Related Readings:

Re:shipping code (1998) [OT] Read and weep (2003) funky character (2002) Error Log.db --however (1997) Re2: frames & carts (1997) strange result? (2003) Closing Databases (1998) Multiple fields on 1 input (1997) Emailer setup (1997) redirect with frames (1997) upload pictures any solution (1999) Dates and Math - Simple Subtraction (2004) How is it done? (1998) [WebDNA] Does [referrer] get lost when server switches from http to (2020) [WebDNA] CORRECTION: 60% failure rate using replace in a loop (2010) [searchString] (1997) errormessages.db (1997) Problems passing [SKU] with $Replace in 2.0 (1997) mime types (2003) (1997)