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 675 posts 1566 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 1372 posts 3103 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 675 posts 1566 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 1372 posts 3103 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 675 posts 1566 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.

Please Sign in or register to post replies

Write your reply to:

Draft