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 899635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T15:15:07+00:00 2026-05-15T15:15:07+00:00

I am working in the confines of a CMS system, which defines certain fields

  • 0

I am working in the confines of a CMS system, which defines certain fields which can be used to make forms for use within the application in PHP.

The list function has the signature:

function inputBasicList ($id,$value = "",$list = array(), $displayName = NULL, $displayLabel = true)

I use it thusly:

$theinput = new inputBasicList("type",$therecord["paymenttype"],array("Cash"=>"cash","Credit"=>"credit"), "Payment Type");

Likewise, there is a checkbox, which has the signature:

function inputCheckbox($id,$value = false, $displayName = NULL, $disabled = false, $displayLabel = true)

I use it thusly

$theinput = new inputCheckbox("paid", $therecord["paid"], "Paid");

What I would like to do, is if the list is set to credit instead of the default cash, to automatically set the checkbox to true/checked.

I don´t think the CMS system allows a way to do this using any built in functions, and am wary of adding any javascript.

Is such a thing possible with just PHP?

Otherwise, how complicated would the javascript have to be to do such a thing?

edit:

The generated HTML from the phpBMS forms

<p class="big"><label for="type" class="important">Payment Type</label>
<br />
<select name="type" id="type"  class="important" > 
<option value="cash"  >Cash</option>
<option value="credit"  >Credit</option>
</select>
</p>
<p class="big">
<input type="checkbox" id="paid" name="paid" value="1" class="radiochecks"  /> 
<label id="paidLabel" for="paid" >Paid</label>
</p>
  • 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-05-15T15:15:07+00:00Added an answer on May 15, 2026 at 3:15 pm

    It’s not possible to do such thing with PHP only, because PHP is run on your server. You need some code that is run on the client.

    I believe that the first paramater $id is used as id attribute for the elements? If I’m wrong correct me. If so you can do the following using the jQuery JavaScript Library:

    jQuery(function($){
      $('#type').change(function(){
        if ($(this).val() == "credit") {
          $('#paid').attr('checked','checked');
        } else {
          $('#paid').removeAttr('checked');
        }
      });
    });
    

    UDPATE
    BMS is using Mootools, the JavaScript should like like this to work in mootools:

    window.addEvent('domready', function(){
      $('type').addEvent('change',function(){
        if($(this).get('value') == 'credit') {
          $('paid').set('checked','checked');
        } else {
          $('paid').removeProperty('checked');
        }
      });
    });
    

    I would recommend using the mootools version of this snippet, but just for your interest, if you want to install jQuery, you can add the jquery.js into phpbms/common/javascript. Then you can edit phpbms/header.php to include this:

    after the last $tempjsarray[] add:

    $tempjsarray[] = "common/javascript/jquery.js";
    

    then after $phpbms->showJsIncludes(); you need to include this, so jQuery works without problems besides mootools:

    echo '<script type="text/javascript">jQuery.noConflict();</script>';
    

    If this doesn’t work, you should post what the html output looks like.

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

Sidebar

Related Questions

I am working within the confines of a php based CMS like system, which
I am currently working within the confines of sharepoint 2007 and have some code
Working on a bunch of forms at the moment and I'm finding that I
Working on a rather small, and simple layout, I decided to use Meyer's CSS
Working on my first Rails project, I used Ryan Bates' Nifty-Generators to create the
Working on joining up two legacy DB systems into new database where I can
Working on a new app and using restful-authentication. I was trying to make it
We have been wrestling with the confines of ASP.NET trying to get JSONP working.
I am working on a project within Python that is to determine the multi-tasking
Working with Json, how can I NSlog only the title in this code: NSDictionary

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.