Copied to clipboard

Flag this post as spam?

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


  • Rasmus Fjord 659 posts 1546 karma points c-trib
    Sep 05, 2012 @ 13:31
    Rasmus Fjord
    0

    Can we use a non JS approch on submits

    Hey guys :) 

    I love the JS api its pure awesomeness. But is it just me but shouldnt this just work aswell ?

       <form action="/tcbase/teacommerce/SubmitForm.aspx" name="sub" method="post">
                                <input name="addUniqueOrderLine" type="hidden" value="nodeId,orderLineId,quantity">
                                <input name="nodeId" type="hidden" value="@orderline.NodeId">
                                <input name="orderLineId" type="hidden" value="@orderline.Id" />
                                <input name="quantity" type="hidden" value="-1">
                                <button type="submit" class="subtract" value="+">
                                    x</button>
                            </form>

     

    Ive done the same thing with a removeorderline and that just worked, but this just dosnt work.(ofc the right values are in the value fields.)

    it works if i call it with JS like 


    TeaCommerce.addUniqueOrderLine(1168,114,-1);

  • Rune Grønkjær 1303 posts 2895 karma points
    Sep 05, 2012 @ 13:39
    Rune Grønkjær
    0

    Hi Rasmus,

    Thanks for the kind words of awesomeness. :)

    Yes, that should work. Maybe because your button is "button" and not submit?

    Or maybe because the AddUniqueOrderLine name must be with capital first letter.

    /Rune

  • Rasmus Fjord 659 posts 1546 karma points c-trib
    Sep 05, 2012 @ 13:43
    Rasmus Fjord
    0

    Awesome it worked.

    it was the capitol letter. I thought i was supposed to "call" it just as the JS functions (my bad)

  • Rune Grønkjær 1303 posts 2895 karma points
    Sep 05, 2012 @ 13:49
    Rune Grønkjær
    0

    Yeah. That would be our best practice naming. Small first letters in JavaScript. Capital letters in C#.

    Good thing you got it running. JavaScript fallback is always a good idea. Although people with no JavaScript must be used to weird website behavior.

    /Rune

  • Rasmus Fjord 659 posts 1546 karma points c-trib
    Sep 05, 2012 @ 14:30
    Rasmus Fjord
    0

    Yea non js people must have a shitty experience :) but fallbacks are nice, and with JQ we can just throw in a quick post serialize form or something like that.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies