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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T13:38:51+00:00 2026-06-04T13:38:51+00:00

I am using CodeCanyon’s Price Calculator, and am having some Javascript trouble. The first

  • 0

I am using CodeCanyon’s Price Calculator, and am having some Javascript trouble.

The first field calculates the tuition amount based on the number of credit hours.

The second field (where I’m having trouble) is supposed to take the number of credit hours selected from the first field, divide it by 3 to get the number of classes, and then multiply by 100 to arrive at the amount of money needed for textbooks.

I have tried achieving this equation with Javascript and some ASP, but haven’t been successful. I’m no Javascript expert, but here is the code as it presently stands. Any help is much appreciated!

HTML markup

The “f_4” and “f_7-textbooks” are variables named in the script below.
f_4 is the number of credit hours selected.
In f_7-textbook, I’ve attempted to call the value of f_4, divide it by 3 and multiply it by the value sent from the database (hence, <%=budgetRS(“budget_BooksandSupplies_sem1”)%>), which is set to “100”.

<fieldset>
<p>1 class = 3 credit hours.</p>
<p>
    <label>Number of Credit Hours: <input class="spinner" type="text" id="f_4" name="f_4" data-spinner='{"min": 0, "max": 42, "step": 3}' data-default="0" value="3" data-cost="<%=FormatNumber(budgetRS("budget_Tuition_sem1"), 2)%>"/></label> 
    <span class="staticPrice">
    </span>
</p>
<p>
    Textbook Estimate ($<%=budgetRS("budget_BooksandSupplies_sem1")%>/3 credit hours): 
    <input type="hidden" name="f_7-textbooks" value="{f_4}/3*<%=budgetRS("budget_BooksandSupplies_sem1")%>" />
</p>
</fieldset>

Javascript

<script type="text/javascript">
$(function(){
    var form = $('#jquery-order-form');

    //form.find('span.staticPrice').remove();
    form.find('option').each(function(i){
        var opt = $(this)
        opt.text(opt.val());
    });

    var items = [];
    items['f_4'] = 'Credit Hours ($<%=budgetRS("budget_Tuition_sem1")%>/credit hour)';
    items['f_7-textbooks'] = 'Textbook Estimate ($<%=budgetRS("budget_BooksAndSupplies_sem1")%>/credit hour)';

    });

});
</script>

The full code for this calculator is available at http://media.briercrest.ca/calculators/collegecalculator.asp

  • 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-04T13:38:53+00:00Added an answer on June 4, 2026 at 1:38 pm

    You are trying to use client side values in your serverside code which has no access to this data and is resulting in being output.

    <input type="hidden" name="f_7-textbooks" value="{f_4}/3*100">
    

    You should use only client side values in your client side code and vice versa for your server side.

    The code below should get the value you require.

    $('.ui-spinner-button').click(function() { $(this).siblings('input').change(); });
    
    $('#f_4').spinner().change(function() {
       var f4Val = $('#f_4').val();
       var calcValue = (f4Val/3)*100;
       $('input[name="f_7-textbooks"]').val(calcValue);
    });
    

    See this fiddle

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

Sidebar

Related Questions

Using Orchard CMS 1.4.2, I'm having trouble posting a form in my custom module.
I am using the following plugin: http://codecanyon.net/item/dynamic-step-process-panels/118950 and I am trying to modify its
Using C# for ASP.NET and MOSS development, we often have to embed JavaScript into
Using the javascript function function squareIt(number) { return number * number; } When given
Using the navigator.geolocation object in JavaScript. Trying to establish accurate ranges, but wondering exactly
Hello I am currently using the smoothZoom plugin in a project (http://codecanyon.net/item/smooth-zoom-pan-jquery-image-viewer/511142). I have
Using Visual Studio / C#, I've been debugging some nunit tests recently, and am
Using Xcode4.2.1, with a basic PhoneGap template based app. (I say template, but I
Using jQuery UI Resizable I'm trying to prevent resizing based on various rules. The
Using C# .NET 3.5 and WCF, I'm trying to write out some of the

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.