[wp-hackers] Dynamic ajax tariff/price/services form ?

alecsGarza alecs.garza at gmail.com
Mon Aug 22 03:11:50 UTC 2011


Hello B2,

I believe that both examples use javascript to alter the price

You basically need to establish callback functions

For example on a radio button

<input name="numMen" type="radio" value="30"
onclick="Javascript:calculate_amounts();Javascript:calculate_mortgage()"/>

and setup the functions in javascript with the proper calls to your form's
elements


function calculate_amounts() {
var form = document.mortgage_calc_form;
  for (var i=0; i < document.mortgage_calc_form.tamLoteB.length; i++){
   if (document.mortgage_calc_form.tamLoteB[i].checked){
 form.total_property_value.value =
document.mortgage_calc_form.tamLoteB[i].value * form.precio50Enganche.value;
 }
}
 for (var i=0; i < form.enganche.length; i++){
   if (form.enganche[i].checked){
 if (form.enganche[i].value == 99) {
 form.masEnganche.disable=false;
 if(form.masEnganche.value<13 || form.masEnganche.value>90){
form.masEnganche.value=13;
 }
form.deposit.value = (form.masEnganche.value/100) *
form.total_property_value.value;
 }else{
form.masEnganche.disable=true;
form.deposit.value = form.enganche[i].value *
form.total_property_value.value;
 }
 }
 }
 for (var i=0; i < form.numMen.length; i++){
   if (form.numMen[i].checked){
form.duration.value = form.numMen[i].value;
 }
}
 form.loan.value = (form.total_property_value.value - form.deposit.value);
 }


On Fri, Aug 19, 2011 at 2:40 AM, b2 <b2 at sysadmins-bg.net> wrote:

> Hi , is there any plugins (or maybe some quick howto/examples) out, or
> something to achieve something like this ?
>
> http://www.telnet.bg/index.php?mod=calc
> http://arenanet.tv/connect.php
>
> Basically i want to setup custom service/tarrif/price calculator , and
> cannot find any quick solution.
> I tried price-calc but  it so basic , so if i had to use it , i'll have
> to rewrite it at all (i'm not familiar with ajax/js , im ok with php) ,
> the plugin developer cannot provide any support at this tume ... so
> thats not a solution.
>
> thanks in advance
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list