Results 1 to 8 of 8

Thread: Web to Lead Form does not validate

  1. #1
    kenlyle is offline Sugar Community Member
    Join Date
    Nov 2004
    Posts
    168

    Default Web to Lead Form does not validate

    In Sugar OS 4.5.1d, I have a web form that is passing the entered fields correctly. I had only one required field when I generated the form from Sugar, which was Last Name. I generated the form on 4.5.1c, I think, or maybe b, if that matters.

    What seems to be different about the required field is this HTML: <span style="color: rgb(255, 0, 0);" class="required">*</span>

    So I put that into the corresponding position on two other fields, and they show up with the red asterisks, as expected.

    The required fields are all now like:
    <td style="text-align: left; font-size: 12px; font-weight: normal;" width="15%"><span sugar="slot">First Name: </span><span style="color: rgb(255, 0, 0);" class="required">*</span></td>

    Problem is that the fields are not truly required, only Last Name is.

    What do I need to do to make the other fields required?

    Thanks,
    Ken

  2. #2
    sacramentojoe is offline Sugar Community Member
    Join Date
    Nov 2005
    Posts
    447

    Default Re: Web to Lead Form does not validate

    You need to edit the vardefs.php and set required => true.

    if it's a custom field, you need to edit it and make it required as well.

  3. #3
    kenlyle is offline Sugar Community Member
    Join Date
    Nov 2004
    Posts
    168

    Default Re: Web to Lead Form does not validate

    Hmmm. Thanks. OK, I see how that could work, but I don't really want to chanage how the Sugar database backend works, I just want to make the fields required in the HTML form.

    I made the other fields have the same "class", which is apparently a font color of red, and then the asterisk.

    I thought that the HTML/Javascript was reading the fields in the local file checking for required class, but then I thought it must be checking the vardefs....apparently, both were wrong...

    So I modified the vardefs.php under Leads, putting
    'required'=>true,
    after type, just like the records that were already there, but No Joy, the form still does not validate. It will take a single letter into the First Name field and then pass through to the document that is the reward for filling the form.

    I regenerated the form, and found that the critical code/lines seems to be of the form:

    <tr>
    <td style="display: none;"><input value="email1;first_name;last_name;" name="req_id" id="req_id" type="hidden"></td>
    </tr>

    That hidden field contains the array of required fields, which is what the code is checking.

    Thanks for the tip.

    Ken
    Last edited by kenlyle; 2007-05-26 at 09:32 PM.

  4. #4
    sacramentojoe is offline Sugar Community Member
    Join Date
    Nov 2005
    Posts
    447

    Default Re: Web to Lead Form does not validate

    Ken, you say that it will take a single character in the first name field and then pass through. That sounds right to me. You are stating that it's required, 1 character meets the validation. How about with nothing in the first name field?

    Oh, and on a note, I'm not sure if it matters or not but in my vardefs.php, true is treated as a string, not a boolean.

  5. #5
    kenlyle is offline Sugar Community Member
    Join Date
    Nov 2004
    Posts
    168

    Default Re: Web to Lead Form does not validate-Solved

    Oh, sorry, I was unclear.

    With 3 fields marked with the appropriate required class in the HTML, and entering only one character in one required field and NOTHING in the other two, it was passing through.

    As I later found, the issue was that I was missing the req_id array as described above.

    So it's now solved, but that clarifies what I was seeing, and why I was interpreting it as wrong.

    Thanks, SacJoe!
    K

  6. #6
    sacramentojoe is offline Sugar Community Member
    Join Date
    Nov 2005
    Posts
    447

    Default Re: Web to Lead Form does not validate-Solved

    Glad you figured it out. Have a good one.

  7. #7
    markb1439 is offline Junior Member
    Join Date
    Dec 2007
    Posts
    1

    Default Re: Web to Lead Form does not validate

    I'm having a strange issue with form validation. If a user tries to submit the form without meeting the validation criteria, the warning appears. But when the user clicks "OK", before they can enter any more info the form is sent anyway.

    Example:

    http://www.codecsunlimited.com/sales-inquiry.html

    Any ideas?

    Thanks,

    Mark B.

  8. #8
    monkeyfish is offline Sugar Community Member
    Join Date
    Mar 2008
    Posts
    29

    Default Re: Web to Lead Form does not validate

    Where can I find the vardefs.php file?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 5
    Last Post: 2007-06-22, 03:57 AM
  2. Web to Lead Form Save
    By whipsaw in forum Installation and Upgrade Help
    Replies: 1
    Last Post: 2007-04-02, 06:38 PM
  3. Replies: 9
    Last Post: 2006-12-15, 04:10 AM
  4. Lead from Web form
    By sanver in forum Help
    Replies: 5
    Last Post: 2006-11-19, 10:50 AM
  5. Looking for web-based lead input form. v. 3.5.1
    By pozole in forum Classifieds
    Replies: 5
    Last Post: 2006-06-05, 07:58 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •