- This topic is empty.
July 5, 2012 at 9:50 am #37738
I’m thinking about adding a contact form to my my art league’s website.
It’ll have just five fields (TO, with the addressees selectable from a list; YOUR NAME, a text field without any pattern-matching validation; YOUR PHONE, also text with no pattern-matching validation; YOUR EMAIL, a text field probably with some validation to insure a valid email address syntax; and MESSAGE, a text field probably with a maximum character limit) plus, of course, a SEND button. Even though this will be my first form, I’ve read enough that I think I can handle the markup and CSS, so I’m not asking for help with that (at least not yet).
But we’ll need to have either YOUR PHONE or YOUR EMAIL required – one of these, but not both.
Some Google searching suggests that this is possible using scripting, or possibly if you’re using PHP. Unfortunately I am completely inexperienced with scripting and PHP, so those are not options for me.
Is there a pure HTML/CSS way to accomplish this?
ThanksJuly 5, 2012 at 10:29 am #105408Paulie_DMember
“But we’ll need to have either YOUR PHONE or YOUR EMAIL required – one of these, but not both.”.
People won’t understand that, if they see two fields they’ll automatically complete them especially as they are compulsory (in effect).
If you need one of two, I’d give them an option to select their preferred choice and then reveal the necessary input.
Alternatively, make them enter both but insist on a ‘preferred’ method…it’s just coming at it from the other direction.July 5, 2012 at 11:04 am #105411
Thanks for the quick response – I appreciate it.
Just to clarify:
I was planning on having something (maybe an * with a note “* = required”) to indicate required fields, but got stuck on how to indicate that we’d like both but only 1 of the 2 was required.
I wasn’t thinking of including the sentence “But we’ll need to have either YOUR PHONE or YOUR EMAIL required – one of these, but not both.” on the form., but maybe that’s the simplest way to go if I phrase it better.
And maybe I’m wrong, but if I see a form with fields for my phone number and email address that are NOT required, I’ll usually leave them blank. I think that people are increasingly realizing that it’s not in their best interests to divulge this info (selling to telemarketers, opening the door to SPAM, etc.) unless it’s absolutely necessary.July 5, 2012 at 2:41 pm #105445
As I said, I have zero experience/knowledge of PHP or scripting, but I think I follow your example. Will try it later today.
Meanwhile, is it true that there’s no way to do this (make it so that either of two fields is required) with just HTML & CSS?
- The forum ‘Other’ is closed to new topics and replies.