Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Peter Prokein 29 posts 105 karma points
    Apr 06, 2013 @ 01:52
    Peter Prokein
    0

    how to retrieve field IDs? (how to perform math on form fields?)

    Let's say you have a form field that captures the quantity of something, then you need to multiply that quantity by the price.  How does one go about that in Contour?

    In a static form this would look something like this:

    <form action="processPayment.aspx" method="post" name="registration" id="registration">
        <label for="qtyA" class="label">Quanity Alabel>
        <input name="qtyA" type="text" id="qtyA" /><br />
        <label for="total" class="label">Total Chargelabel>
        <input name="total" type="text" id="total" readonly="true" /><br />
        <input id="submit" type="submit" value="submit" />
    form>
    
    <script type="text/javascript">
        var costA = 10;
        var totalCharge = 0;
        $('#qtyA').blur(function () {
            totalCharge = $('#qtyA').val() * costA;
            $('#total').val(totalCharge);
        });
    script>

    It's not really clear to me how to retrieve the IDs of each individual field in in the Contour implementation. I can obviously inspect the fields and copy&paste the field ID that way, but there ought to be an easier way to obtain the relevant IDs programatically?

    I am not familiar with MVC which is likely the biggest hurdle in getting this resolved.

    I get that in order to do anything to a form I need to create a customized view for it?
    In /umbraco\plugins\umbracoContour\Views\Forms\? Or is that view just for the markup customization?  So lost ... :(

Please Sign in or register to post replies

Write your reply to:

Draft