Support » Plugin: Contact Form 7 » Problem with setting default field value

  • Resolved Permaculture Yarra Valley

    (@permaculture-yarra-valley)


    Hi,
    I have inherited the admin of a NFP website and need to change some field values as fees have changed.
    I tried to change the values but the Total Payment seems to use the old value no matter what I try.
    For example, the Fee is set to $5 and if you add a Donation in the donation field, the Total Payment adds the donation to the old Fee (which was $25).
    I can’t find where to set the Fee to $5 as whatever I try, the Total Payment uses $25 in it’s calculation. Same error if you adjust the Extra drop down.
    Feel free to play with the form to see what happens.

    Any assistance would be appreciated.
    Thanks
    Peter

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Takayuki Miyoshi

    (@takayukister)

    See Editing form template

    What content do you have in the Form tab panel?

    Thread Starter Permaculture Yarra Valley

    (@permaculture-yarra-valley)

    Hi Takayuki,
    I replied to this post yesterday but it hasn’t appeared so here it is again.
    I have pasted the code below. I assume this is what you want.
    Thanks.
    Peter

    <h4>Membership Details</h4>
    <div class=”row”>
    <div class=”medium-12 columns”>
    <label>Name(s) (required)
    [text* names] </label>
    </div>
    </div>
    <div class=”row”>
    <div class=”medium-12 columns”>
    <label>Mailing Address (required)
    [text* mailing-address] </label>
    </div>
    </div>
    <div class=”row”>
    <div class=”medium-6 columns”>
    <label>Suburb (required)
    [text* suburb] </label>
    </div>
    <div class=”medium-6 columns”>
    <label>Postcode (required)
    [text* postcode minlength:4 maxlength:4] </label>
    </div>
    </div>
    <div class=”row”>
    <div class=”medium-6 columns”>
    <label>Phone
    [text phone] </label>
    </div>
    <div class=”medium-6 columns”>
    <label>Mobile
    [text mobile] </label>
    </div>
    </div>
    <div class=”row”>
    <div class=”medium-6 columns”>
    <label>Primary Email (required)
    [email* primary-email] </label>
    </div>
    <div class=”medium-6 columns”>
    <label>Email for extra person
    [email secondary-email] </label>
    </div>
    </div>
    <hr>
    <h4>Membership Fees</h4>
    <div class=”row”>
    <div class=”large-6 columns”>
    <label>Single ($5 per annum)</label>
    </div>
    <div class=”large-6 columns”>
    <div class=”row collapse”>
    <div class=”small-2 columns”>
    <span class=”prefix”>$</span>
    </div>
    <div class=”small-10 columns”>
    <input class=”input-group-field” type=”text” id=”fee” name=”fee” enabled value=”5.00″ style=”background-color:#fefefe;”>
    </div>
    </div>
    </div>
    </div>
    <div class=”row”>
    <div class=”large-6 columns”>
    <label>Extra adult at same address ($1 per person per annum)</label>
    </div>
    <div class=”large-6 columns”>
    <div class=”row collapse”>
    <div class=”small-2 columns”>
    <span class=”prefix”>+</span>
    </div>
    <div class=”small-10 columns”>
    <select id=”extra” name=”extra” style=”background-color:#fefefe;”>
    <option value=”0″>0 extra</option>
    <option value=”1″>1 extra</option>
    <option value=”2″>2 extra</option>
    <option value=”3″>3 extra</option>
    <option value=”4″>4 extra</option>
    </select>
    </div>
    </div>
    </div>
    </div>
    <div class=”row”>
    <div class=”large-6 columns”>
    <label>Donation</label>
    </div>
    <div class=”large-6 columns”>
    <div class=”row collapse”>
    <div class=”small-2 columns”>
    <span class=”prefix”>$</span>
    </div>
    <div class=”small-10 columns”>
    <input class=”input-group-field” type=”number” id=”donation” name=”donation” value=”0″ style=”background-color:#fefefe;”>
    </div>
    </div>
    </div>
    </div>
    <div class=”row”>
    <div class=”large-6 columns”>
    <label>Total Payment</label>
    </div>
    <div class=”large-6 columns”>
    <div class=”row collapse”>
    <div class=”small-2 columns”>
    <span class=”prefix”>$</span>
    </div>
    <div class=”small-10 columns”>
    <input class=”input-group-field” type=”text” id=”total” name=”total” readonly style=”background-color:#eee;” value=”5.00″>
    </div>
    </div>
    </div>
    </div>
    <hr>
    <h4>Method of Payment</h4>
    <div class=”row”>
    <div class=”medium-6 columns”>
    [checkbox* payment-method use_label_element exclusive default:1 “Direct Deposit to Permaculture Yarra Valley” “Cheque” “Cash”]
    </div>
    <div class=”medium-6 columns”>
    BSB: Bendigo Bank 633-000 <br>Account No 122524291
    Direct deposit preferred – please put your full name in the reference field
    </div>
    </div>
    <h4>Application Type</h4>
    <div class=”row”>
    <div class=”medium-12 columns”>
    [checkbox* application-type use_label_element exclusive default:1 “New Membership” “Membership Renewal”]
    </div>
    </div>
    <h4>Permaculture Design Certificate</h4>
    <div class=”row”>
    <div class=”medium-12 columns”>
    [checkbox* pdc use_label_element exclusive default:1 “I have completed a PDC” “I have NOT completed a PDC”]
    </div>
    </div>
    <hr>
    <h4> Other Information</h4>
    [textarea other-information]

    <p>By Submitting this , I/we support the purposes of Permaculture Yarra Valley and in the event of my/our admission to membership; I/we agree to be bound by the Rules of the Association for the time being in force.</p>

    [submit class:button “Submit Application”] Print

    Plugin Author Takayuki Miyoshi

    (@takayukister)

    In the Membership Fees section there is no form-tag of Contact Form 7 used. This means the calculation is done outside Contact Form 7.

    I found this JS in the HTML source:

    <script>
    
        $( '#donation' ).change( function() {
    		var total = 25+eval($( '#donation' ).val())+eval($( '#extra' ).val());
            $( '#total' ).val(parseFloat(total).toFixed(2));
    		
        } );
        $( '#extra' ).change( function() {
    		var total = 25+eval($( '#donation' ).val())+eval($( '#extra' ).val());
            $( '#total' ).val(parseFloat(total).toFixed(2));
        } );
    
    </script>

    I guess you have this in a template file of the theme you use.

    Thread Starter Permaculture Yarra Valley

    (@permaculture-yarra-valley)

    Thanks very much Takayuki,
    I will now need to work out how to update it.
    Regards
    Peter

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Problem with setting default field value’ is closed to new replies.