Submit Your Article Forum Rules

Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: two style sheets problem

  1. #11
    Junior Member
    Join Date
    Aug 2011
    Posts
    4
    here are the codes by the way:

    popup-contactform.php:

    Code:
    <?php
    
    require_once("./include/fgcontactform.php");
    $formproc = new FGContactForm();
    
    //1.Add your email address here.
    //You can add more than one receipients.
    $formproc->AddRecipient('info@tercume.com'); //<<---Put your email address here
    
    //2. For better security. Get a random string
    // and put it here
    $formproc->SetFormRandomKey('dz0sbNoc7mZPgXa');
    
    if(isset($_POST['submitted']))
    {
        if($formproc->ProcessForm())
        {
            echo "success";
        }
        else
        {
            echo $formproc->GetErrorMessage();
        }
    }
    ?>


    contactform-code.php:
    Code:
    <script type='text/javascript' src='scripts/gen_validatorv31.js'></script>
    <script type='text/javascript' src='scripts/fg_ajax.js'></script>
    <script type='text/javascript' src='scripts/fg_moveable_popup.js'></script>
    <script type='text/javascript' src='scripts/fg_form_submitter.js'></script>
    <div id='fg_formContainer'>
        <div id="fg_container_header">
            <div id="fg_box_Title">Contact us</div>
            <div id="fg_box_Close"><a href="javascript:fg_hideform('fg_formContainer','fg_backgroundpopup');">Close(X)</a></div>
        </div>
    
        <div id="fg_form_InnerContainer">
        <form id='contactus' action='javascript:fg_submit_form()' method='post' accept-charset='UTF-8'>
    
        <input type='hidden' name='submitted' id='submitted' value='1'/>
        <input type='hidden' name='<?php echo $formproc->GetFormIDInputName(); ?>' value='<?php echo $formproc->GetFormIDInputValue(); ?>'/>
        <input type='text'  class='spmhidip' name='<?php echo $formproc->GetSpamTrapInputName(); ?>' />
        <div class='short_explanation'>* required fields</div>
        <div id='fg_server_errors' class='error'></div>
        <div class='container'>
            <label for='name' >Your Full Name*: </label><br/>
            <input type='text' name='name' id='name' value='' maxlength="50" /><br/>
            <span id='contactus_name_errorloc' class='error'></span>
        </div>
        <div class='container'>
        <label for='email' >Email Address*:</label><br/>
            <input type='text' name='email' id='email' value='' maxlength="50" /><br/>
            <span id='contactus_email_errorloc' class='error'></span>
        </div>
        <div class='container'>
            <label for='message' >Message:</label><br/>
            <span id='contactus_message_errorloc' class='error'></span>
            <textarea rows="10" cols="50" name='message' id='message'></textarea>
        </div>
    
        <div class='container'>
            <input type='submit' name='Submit' value='Submit' />
        </div>
        </form>
        </div>
    </div>
    <!-- client-side Form Validations:
    Uses the excellent form validation script from JavaScript-coder.com-->
    
    <script type='text/javascript'>
    // <![CDATA[
    
        var frmvalidator  = new Validator("contactus");
        frmvalidator.EnableOnPageErrorDisplay();
        frmvalidator.EnableMsgsTogether();
        frmvalidator.addValidation("name","req","Please provide your name");
    
        frmvalidator.addValidation("email","req","Please provide your email address");
    
        frmvalidator.addValidation("email","email","Please provide a valid email address");
    
        frmvalidator.addValidation("message","maxlen=2048","The message is too long!(more than 2KB!)");
    
        document.forms['contactus'].refresh_container=function()
        {
            var formpopup = document.getElementById('fg_formContainer');
            var innerdiv = document.getElementById('fg_form_InnerContainer');
            var b = innerdiv.offsetHeight+30+30;
    
            formpopup.style.height = b+"px";
        }
    
        document.forms['contactus'].form_val_onsubmit = document.forms['contactus'].onsubmit;
    
    
        document.forms['contactus'].onsubmit=function()
        {
            if(!this.form_val_onsubmit())
            {
                this.refresh_container();
                return false;
            }
    
            return true;
        }
        function fg_submit_form()
        {
            //alert('submiting form');
            var containerobj = document.getElementById('fg_form_InnerContainer');
            var sourceobj = document.getElementById('fg_submit_success_message');
            var error_div = document.getElementById('fg_server_errors');
            var formobj = document.forms['contactus']
    
            var submitter = new FG_FormSubmitter("popup-contactform.php",containerobj,sourceobj,error_div,formobj);
            var frm = document.forms['contactus'];
    
            submitter.submit_form(frm);
        }
    
    // ]]>
    </script>
    
    <div id='fg_backgroundpopup'></div>
    
    <div id='fg_submit_success_message'>
        <h2>Thanks!</h2>
        <p>
        Thanks for contacting us. We will get in touch with you soon!
        <p>
            <a href="javascript:fg_hideform('fg_formContainer','fg_backgroundpopup');">Close this window</a>
        <p>
        </p>
    </div>

  2. #12
    Junior Member
    Join Date
    Dec 2008
    Posts
    9
    The javascript syntax you would use to set the value of the form elements to "" is:
    var target = document.getElementById('field-name-goes-here');
    target.value = "";
    You would just repeat this code for each of the fields you want to blank out, remembering to replace the "field-name-goes-here" with your actual field name.

    I haven't studied the code too much, but I believe you would put the blanking scripts in the function: document.forms['contactus'].onsubmit=function()
    Last edited by denvermatt; 08-09-2011 at 07:13 PM.

  3. #13
    Administrator weegillis's Avatar
    Join Date
    Oct 2003
    Posts
    5,788
    Quote Originally Posted by denvermatt View Post
    You would just repeat this code for each of the fields you want to blank out, remembering to replace the "field-name-goes-here" with your actual field name.
    Pretty much popping them out, like we talked about above. It's generic enough in the DOM to pop them off the form array. No field names. Pop the data out, and it's gone. The array just got one element shorter.

    Quote Originally Posted by ibid
    I haven't studied the code too much, but I believe you would put the blanking scripts in the function: document.forms['contactus'].onsubmit=function()
    This method is very abstract. Which line does one insert where? It does follow, though, I'll give you that. Above, we began to drill down into the scripts that you haven't studied, is all.
    Last edited by weegillis; 08-09-2011 at 11:14 PM. Reason: S/G

  4. #14
    Administrator weegillis's Avatar
    Join Date
    Oct 2003
    Posts
    5,788

    Question Afterthought

    One supposes that having popped all the data out the form array, it wouldn't be a strain on the system to create a new form object at this point, and abandon the nulled out post object. It's got no length, only it's pointers occupying space. Is this OOP thinking? @kgun, where are you?
    Last edited by weegillis; 08-09-2011 at 11:38 PM. Reason: S/G

  5. #15
    Junior Member
    Join Date
    Dec 2008
    Posts
    9

    This is what I was thinking...

    I think adding the "for" loop in the submit function might do it (haven't tested it):

    Code:
    document.forms['contactus'].onsubmit=function()
    {
        if(!this.form_val_onsubmit())
      {
          this.refresh_container();
        return false;
      }
    
        /**** New code begins here ****/
        for(i=0; i<document.forms['contactus'].elements.length; i++)
        {
            document.forms['contactus'].elements[i].value = "";
        }
        /**** New code ends here ****/
    
        return true;
    }
    Only problem is that it looked to me like there were some hidden fields with account numbers or something, so might need to add an exception for those so they don't get blanked along with the others. Not sure.

Page 2 of 2 FirstFirst 12

Posting Permissions

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