Results 1 to 8 of 8

Thread: Web Lead Form - Submit button does nothing.

  1. #1
    toddbenjamin is offline Junior Member
    Join Date
    Apr 2009
    Posts
    2

    Default Web Lead Form - Submit button does nothing.

    I am successfully creating the Web Lead form using the generator in SugarCRM campaigns, but when I fill out the form and "submit" nothing happens.

    I am using Firefox to create and test the submit for the form.
    This is current sugar version, just downloaded and setup last week. No other errors in the client that I can see.
    I am also hosting the file inside the sugar folder structure right now, accessing it in the same folder it gets created in. Would that cause this problem?

    First time help request for a brand new sugar user!

    Thanks,
    Todd

  2. #2
    crmsiva's Avatar
    crmsiva is offline A Sugar Hero
    Join Date
    Jan 2009
    Location
    Chennai, India
    Posts
    1,130

    Default Re: Web Lead Form - Submit button does nothing.

    Strange. Did you change the code of generated web form?

  3. #3
    sethp is offline Senior Member
    Join Date
    Aug 2010
    Posts
    25

    Default Re: Web Lead Form - Submit button does nothing.

    I am having the same issue. I have not modified the form's code at all.

    I am using Sugar 6.0.1 CE, Firefox 3.6.10. I am trying to host the form on a Wordframe.com site.

  4. #4
    john9797 is offline Junior Member
    Join Date
    Jul 2011
    Posts
    6

    Default Re: Web Lead Form - Submit button does nothing.

    I also have this problem in firefox. This error appears at the console when hitting "submit"

    Error: document.getElementById(req_fields[i]) is null
    Line: 497

    Version 5.2.0e (Build 5626)

    How do I fix this?

  5. #5
    kuske's Avatar
    kuske is offline Sugar Community Member
    Join Date
    Oct 2007
    Location
    Germany
    Posts
    2,597

    Default Re: Web Lead Form - Submit button does nothing.

    getElementById deos not work correctly in some older firefox versions.

    If do not have any bool fields in the form you can remove the bool_id block

    PHP Code:
         if(document.getElementById('bool_id') != null){
            var 
    reqs=document.getElementById('bool_id').value;
            
    bools reqs.substring(0,reqs.lastIndexOf(';'));
            var 
    bool_fields = new Array();
            var 
    bool_fields bools.split(';');
            
    nbr_fields bool_fields.length;
            for(var 
    i=0;i<nbr_fields;i++){
              if(
    document.getElementById(bool_fields[i]).value == 'on'){
                 
    document.getElementById(bool_fields[i]).value 1;
              }
              else{
                 
    document.getElementById(bool_fields[i]).value 0;
              }
            }
          } 
    The req_id block, which checks all mandatory values can be replaced by single tests for all mandatory fields in the form.

    PHP Code:
        if(document.getElementById('req_id') != null){
            var 
    reqs=document.getElementById('req_id').value;
            
    reqs reqs.substring(0,reqs.lastIndexOf(';'));
            var 
    req_fields = new Array();
            var 
    req_fields reqs.split(';');
            
    nbr_fields req_fields.length;
            var 
    req true;
            for(var 
    i=0;i<nbr_fields;i++){
              if(
    document.getElementById(req_fields[i]).value.length <=|| document.getElementById(req_fields[i]).value==0){
               
    req false;
               break;
              }
            }
            if(
    req){
                
    document.WebToLeadForm.submit();
                return 
    true;
            }
            else{
              
    alert('Please provide all the required fields');
              return 
    false;
             }
            return 
    false
       
    }
       else{
        
    document.WebToLeadForm.submit();
       } 
    document.getElementById('req_id') is equivalent to document.<formname>.rq_id

    So you can change document.getElementById('last_name') to
    document.WebToLeadForm.last_name a.s.o.

    The email block can be changed by accessing the email fields directly

    PHP Code:
        if(document.getElementById('webtolead_email1').value.length >0) {
            if(
    document.getElementById('webtolead_email1').value.match(/^w+(['\.\-\+]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/) == null){
              alert('
    Not a valid email address);
            }
        } 
    e.g. change here to
    PHP Code:
        if(document.WebToLeadForm.webtolead_email1.value.length >0) {
            if(
    document.WebToLeadForm.webtolead_email1.value.match(/^w+(['\.\-\+]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/) == null){
              alert('
    Not a valid email address);
            }
        } 
    Harald Kuske
    Pre-Sales Engineer Central Europe

    SUGARCRM Deutschland GmbH
    Erika-Mann-Str. 53, 80636 Munich, Germany
    Email: hkuske@sugarcrm.com
    Home: http://www.sugarcrm.com


  6. #6
    john9797 is offline Junior Member
    Join Date
    Jul 2011
    Posts
    6

    Default Re: Web Lead Form - Submit button does nothing.

    I think I am following, other than the req_id block.
    I have a field called fnamevictim_c. Are you saying there is a way to test if this field is null without using getelementbyid?

    would I do something like this?
    if (fnamevictim_c.value.length <=0 ..... )){
    req=false;
    break;
    }

  7. #7
    john9797 is offline Junior Member
    Join Date
    Jul 2011
    Posts
    6

    Default Re: Web Lead Form - Submit button does nothing.

    I did what you said, and IE compatibility broke.

    I ended up adding an if statement to execute the 2 sets of code based on what browser is being used (Ugh).

    It was not an old version of firefox, it is a new one (4.0.1)

    Thanks for the help.

  8. #8
    kuske's Avatar
    kuske is offline Sugar Community Member
    Join Date
    Oct 2007
    Location
    Germany
    Posts
    2,597

    Default Re: Web Lead Form - Submit button does nothing.

    If you would post the code here we could look for any errors.
    Harald Kuske
    Pre-Sales Engineer Central Europe

    SUGARCRM Deutschland GmbH
    Erika-Mann-Str. 53, 80636 Munich, Germany
    Email: hkuske@sugarcrm.com
    Home: http://www.sugarcrm.com


Thread Information

Users Browsing this Thread

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

Similar Threads

  1. How to submit 'Web Form' as lead source from web form
    By pkelly08 in forum Developer Tutorials
    Replies: 0
    Last Post: 2008-10-07, 01:40 AM
  2. Replies: 0
    Last Post: 2008-10-07, 12:50 AM
  3. Form submit and redirect problem
    By gamars in forum Help
    Replies: 13
    Last Post: 2008-07-23, 03:32 PM
  4. Replies: 2
    Last Post: 2007-04-17, 02:46 PM
  5. Replies: 2
    Last Post: 2006-09-12, 11:03 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
  •