Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8729799
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:53:47+00:00 2026-06-13T08:53:47+00:00

// Add an additional field to the checkout within a new fieldset add_filter(‘eshopaddtocheckout’,’eshop_extras_checkout’); function

  • 0
// Add an additional field to the checkout within a new fieldset
add_filter('eshopaddtocheckout','eshop_extras_checkout');

function eshop_extras_checkout($echo){

$echo .= '  <script>
        jQuery(function($) {
            $(".formGroup").hide();
            $("#chooseForm input:checkbox").on("change", function() {
                if($(this).is(":checked")) {
                    $("#" + $(this).val()).show();
                }
                else {
                    $("#" + $(this).val()).hide();
                }
            });
        });

    </script>';



    $echo .= '<fieldset class="eshop eshop_extra">' . "\n";


    $echo .= '<legend>Select the Approriate Form</legend>' . "\n";

    $echo .= ' <div id="chooseForm">
        <input type="checkbox" name="forms2[]" id="ArticlesOrderForm" value="ArticlesOrderForm"> <b>Articles Order Form </b><br>
        <input type="checkbox" name="forms2[]" id="PressReleasesForm"  value="PressReleasesForm"> <b> Press Releases Form </b><br>
    </div>

    <div id="ArticlesOrderForm" class="formGroup">
        <legend>Articles Order Form</legend>
        <label for="kwd1">Art-Keywords1</label><input class="short" type="text" name="kwd1" value="" id="kwd1" maxlength="20" size="20" > <br>

    </div>

    <div id="PressReleasesForm" class="formGroup">
        <legend>Press Releases Form</legend>
        <label for="kwd2">PRKeywords2</label><input class="short" type="text" name="kwd2" value="" id="kwd2" maxlength="20" size="20"> <br>
    </div>';


 $echo .= '<fieldset class="eshop eshop_extra">' . "\n";

    $echo .= '<legend>Extras</legend>' . "\n";
    $echo .= '<label for="eshop_extra">'.__('Extra Field','eshop').' <span class="reqd">*</span><br />
          <input class="short" type="text" name="eshop_extra" value="" id="eshop_extra" maxlength="20" size="20" /></label><br />';
    $echo .= '</fieldset>' . "\n";

    return $echo;
}

  // Add extra field to error checks
    add_filter('eshoperrorcheckout','eshop_extras_errorcheckout');
    function eshop_extras_errorcheckout($_POST){
        $myerror='';

        if(!isset($_POST['eshop_extra']) || trim($_POST['eshop_extra'])==''){
        $myerror= '<li>'.__('<strong>Extra Field</strong> - missing.','eshop_extras').'</li>';
    }



    if(!isset($_POST['ArticlesOrderForm'])) {

      if(!isset($_POST['kwd1']) || trim($_POST['kwd1'])=='') {
        $myerror= '<li>'.__('<strong>KWD1</strong> - missing.','kwd1').'</li>';
        }
    }


    if(!isset($_POST['PressReleasesForm'])) {

      if(!isset($_POST['kwd2']) || trim($_POST['kwd2'])=='') {
        $myerror= '<li>'.__('<strong>KWD2</strong> - missing.','kwd2').'</li>';
        }
    }   


        return $myerror;
    }

** Now iam not getting any syntax erors…. please check below link: (under select the appropriate form) , when u check them, they’re missing away.. what am I doing wrong..? **

articlewritingservicess.com/shopping-cart/checkout/

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T08:53:47+00:00Added an answer on June 13, 2026 at 8:53 am

    You are mixing up server-side code and client-side code.

    PHP is used on the server, and will produce the HTML that is sent to the browser (that HTML can include jquery). But the jquery will only work on the browser.

    The problem is that you are using jquery commands on the server-side, with the following line…
    (This is the 2nd if statement in your eshop_extras_errorcheckout function)

    if($('#check_id').is(":checked"))
    

    This should be PHP code, not jquery… something like…

    if(isset($_POST('check_id'))){
      // Do something
    }
    

    Additional based on OP’s comment

    The reason that your checkboxes are not remaining “checked” on the post-back of the page is because you are creating the <input type="checkbox" code each time, and if you don’t specifically provide the checked attribute, it will be unchecked when the page is displayed.

    (I’m not sure if you’re familiar with ASP.NET, but in that technology if you tick a checkbox and then post-back, ASP.NET will handle this for you. PHP does not do it as standard, you need to tell it to check it.)

    So, for instance, where you are “echo”ing the following line in your eshop_extras_checkout function (note, this is contained with a PHP string, it is not straight mark-up):

    <input type="checkbox" name="forms2[]" id="ArticlesOrderForm"
      value="ArticlesOrderForm"> <b>Articles Order Form </b><br>
    

    … you need to conditionally put the checked attribute, something like this:

    (isset($_POST('ArticlesOrderForm')) ? "Checked" : "")
    

    … which would result in the string looking like

    <input type="checkbox" name="forms2[]" id="ArticlesOrderForm" 
      value="ArticlesOrderForm" ' . (isset($_POST('ArticlesOrderForm')) ? "Checked" : "") . '> <b>Articles Order Form </b><br>
    

    Therefore, when the final HTML is sent to the browser, the attribute checked will appear if the checkbox was checked, and it won’t if it won’t.

    Hope that makes sense

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to add an additional text field to magento's product review. It looks
So, the extra field in a queryset can be used to add additional columns
I am trying to add an additional custom field to a django model. I
I wrapped the django.contrib.auth.views.logout with another function to add additional behaviour. This is my
How do you add extra fields into todo.js? initialize: function() { this.input = this.$(#new-todo);
I use jquerylive plugin to add additional css classes to .field-validation-error class like this:
I have a file field in Drupal 7 that I need to add additional
How can I add additional, custom information to my objective-c methods and properties? I
I want to add additional criteria to the LEFT OUTER JOIN generated by the
I was looking at this question: Add additional data to a Highcharts series for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.