Announcement

Collapse
No announcement yet.

Can I NOT require specific fields in the contact form?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Can I NOT require specific fields in the contact form?

    Can I NOT require specific fields in the contact form?

    For example, if someone want to just shoot us a quick email, I see no reason to require a telephone number. I want to not appear so invasive in asking for information that could very well not even be needed.

    (see attachment)

    Thanks for your help.

    Mike
    Attached Files
    www.KarensCookies.net
    Cookie Decorating Simplified

  • #2
    Wow, this forum is hopping! :) I'll answer my own question.

    I got a response from submitting a ticket that provided a solution. I thought I'd share here in case someone else would like to do this, as it seems like it could be a fairly common request.

    Basically you want to edit contact_us.html (via ftp or through the back-end... whichever you prefer.)

    Look for this section of javascript toward the beginning of the file:
    var strMsg = "";
    if (document.frmForm.customer.value.trim() == "")
    strMsg += " - [crm_name] cannot be blank.\n"
    if (document.frmForm.phone.value.trim() == "")
    strMsg += " - [crm_phone] cannot be blank.\n"
    if (document.frmForm.custemail.value.trim() == "" || !isValidEmail(document.frmForm.custemail.value))
    strMsg += " - [crm_email] cannot be blank and must be a valid email address.\n"
    if (document.frmForm.subject.value.trim() == "")
    strMsg += " - [crm_subject] cannot be blank.\n"
    if (document.frmForm.reply.value.trim() == "")
    strMsg += " - [crm_message] cannot be blank.\n"
    if (document.frmForm.ramdomWord.value.trim() == "")
    strMsg += " - Verification word cannot be blank.\n"
    Basically to functionally make one of the fields NOT required, just find the appropriate line (2 lines actually, as it is rendered here) and delete it. In my case I did not want to have the phone number required so I removed this:
    if (document.frmForm.phone.value.trim() == "")
    strMsg += " - [crm_phone] cannot be blank.\n"
    Next you'll want to visually make this field NOT required. Simply scroll down to where these fields are actually rendered and find the field you're interested in altering. In my case it was phone number and looked like this:
    <td nowrap="nowrap"><input type="text" name="phone" value="[phone]" size="40" maxlength="50" class="txtBoxStyle">
    <img src="assets/templates/common/images/error2.gif" width="12" height="12"> </td>
    Simply remove the "required" image so it will look like this:
    <td nowrap="nowrap"><input type="text" name="phone" value="[phone]" size="40" maxlength="50" class="txtBoxStyle"></td>
    That's it.

    Have fun.
    www.KarensCookies.net
    Cookie Decorating Simplified

    Comment


    • #3
      We also use a similar technique to change the length of the fields. In similar areas of code for other forms, we need to change the max length for input. For example, our credit card processors has a max length for address and zip code that is smaller than what the cart is setup for. As a result, some customers could not check out when using a nine digit zip or 35 character address (our processor had a max of 5 for zip and 25 for address). So, we modified the max lengths for input to match our credit card processors requirements. Also, the returned message for over typing also would report the correct error in max length. HTH

      Comment


      • #4
        Ok, so I discovered a little problem with this...

        When you (as store owner) receive the message through your CRM, and you try to respond, it will NOT let you reply to a customer without a phone number. You try to enter something yourself, and it won't let you. This is kind of lame, and hopefully someone (at 3dcart) reads this and fixes it, otherwise you just have to NOT use the CRM interface and email them manually...

        I was not willing to make my customers place a phone number (if someone wants to ask me when something will be in stock, or how soon I can get something to Oklahoma I don't need them to provide their phone number!) So I did some further tweaking on my contact_us.html page to make it so the field will be populated with something before it sends to me, yet they are required to do nothing. Fortunately I can get away with this because that field does not validate. Just checks to see if it's populated.

        First off here is the code (around line 142 depending on tweaks you've made):
        Code:
        <input type="text" name="phone" value="optional" size="40" maxlength="50" class="txtBoxStyle" onClick="this.value='';" onBlur="if (this.value==''){this.value='optional';}">
        So you get to the form and the phone field is already populated with "optional". If the customer wants us to call them they're free to put their phone number in there. They click in there and it deletes "optional" automatically so they can simply start typing. If they click OFF of that field with their phone number (or anything else) in there, they're good to go. If they leave it blank then the word "optional" pops back in there.

        So the form will send with something in that field, the customer doesn't feel like I'm being overly inquisitive in asking for their information, and your CRM entry will allow you to respond to them through the system (and thus track the dialog).

        Voila!
        www.KarensCookies.net
        Cookie Decorating Simplified

        Comment


        • #5
          Thanks for the tip! :)

          Comment


          • #6
            Thank you to both of you for the information and for posting it for all of us. :)

            Comment


            • #7
              Thank you for the detailed information. I just finished following your instructions and it worked like a charm. Hopefully the next version will allow us to choose which fields are required in an easier manner.

              Comment


              • #8
                This is kind of lame, and hopefully someone (at 3dcart) reads this and fixes it, otherwise you just have to NOT use the CRM interface and email them manually...

                Whenever you run into a problem like this you should submit a support ticket. Although 3dcart staff reads these forums generally the only way things get fixed / changed or otherwise on their radar is through support tickets.
                Nathan
                www.YourCableStore.com

                Comment

                Working...
                X