Skip navigation
The Bowery
Currently Being Moderated

Web App upload form AJAX submission, is it possible?

May 28, 2012 4:32 PM

Tags: #json #ajax #web_apps #web_forms

Hi guys,

 

I'm simply trying to add ajax submission to the Web App Upload Form and not having any luck. Is it possible for this particular form or not campatable?

Below is the "action" attribute:

 

action="/CustomContentProcess.aspx?CCID=14722&OID={module_oid}&OTYPE={ module_otype}&JSON=1"

 

I take it this particular form doesn't allow for JSON as I'm not having any issues with other forms.

 

If anyone has achieved this before it would be great to hear that it's possible.

 

Cheers,

 
Replies
  • Currently Being Moderated
    Jul 27, 2012 12:26 PM   in reply to The Bowery

    Would you share how you solved the problem? Thanks.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 19, 2012 1:54 PM   in reply to The Bowery

    Do you sharing the resolution...I'm having the same problem

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 13, 2013 9:13 AM   in reply to The Bowery

    anyone have the solution to post here?

     
    |
    Mark as:
  • Liam Dilley
    6,714 posts
    Feb 28, 2012
    Currently Being Moderated
    Mar 13, 2013 11:37 AM   in reply to Spencer_wes

    You can not get a json response as it is only supported on web forms but it is a post and in jquery for example you have .post() and .ajax() - Read up on them and you can submit any form through ajax. You just need to learn and understand how to handle the responses that are returned.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 13, 2013 2:47 PM   in reply to Liam Dilley

    Hi Liam, really appreciate your advice so far!

     

    I've spent quite a bit of time on this but I'm still a novice at jquery which doesn't help. This is what I've come up with so far:

    http://www.kiph.co.za/catalog_test3.html

     

    I can't seem to process the form successfully. I've tried intergrating http://demo.businesscatalyst.com/json-form technique but as you pointed out /Default.aspx doesn't elicit a json response. Was just wondering if you had any suggestions on what I've done so far?

     

    Wes

     
    |
    Mark as:
  • Liam Dilley
    6,714 posts
    Feb 28, 2012
    Currently Being Moderated
    Mar 13, 2013 2:56 PM   in reply to Spencer_wes

    http://api.jquery.com/jQuery.ajax/
    Follow that, key is the data type your getting.

    If it is not JSON what happens when you fill in a form normally, what is the result? A page hey, so that would mean it is......

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 14, 2013 12:12 AM   in reply to Liam Dilley

    Ok so that got me to pull an all nighter, thanks Liam .

     

    I seem to have to the form to work except for some minor issues. First is the form keeps on duplicating itself, this is hidden but I'm unsure if it might be problematic later on... Second is I'm occasionally getting an error Object repose for some reason... might be my syntax?

     

    Here the demo: http://www.kiph.co.za/catalog_test3.html

     

    Here's the code:

     

    <script type="text/javascript">

    function jqsub() {

     

     

    var $f = $('#contact_form');

    var $m = $('#message');

    $.ajax({

      type: 'POST',

      url: "/Default.aspx?CCID=30913&FID=155131&ExcludeBoolFalse=True&PageID={mo dule_oid}",

      dataType: "html",

      data: $f.serialize(),

        success: function(data) {

        var formResponse = data;

                                            $('#message').html(data);

                                            $f.fadeOut(); //Hide the form

                     //Hide the form $f.fadeOut();

            },

        error: function(data) {

        alert('error'+data);

        return false;

        }

    });

    }

    </script>

    <!--<script type="text/javascript">

    $(document).ready(function(){

     

    if( document.URL.indexOf("Default.aspx") < 0){

    $("#CAT_Custom_471904 > [value='{module_visitorcountrycode}']").attr("selected", "true");

    $("form[name='catcustomcontentform83165']").submit();

    }

    })

    </script>-->

    <div id="message">

            {module_webappsresults}

            </div>

    <form name="catcustomcontentform83165" method="post" onSubmit="return jqsub()" action="" id="contact_form" enctype="multipart/form-data">

      <div class="webform">

        <div class="item">

          <label for="CAT_Custom_471904">Country</label>

          <br />

          <select name="CAT_Custom_471904" id="CAT_Custom_471904" class="cat_dropdown" onChange="jqsub()">

            <option value="*">-- All --</option>

            <option value="AC">AC</option>

    </select>

        </div>

        <div class="item">

          <input class="cat_button" type="submit" value="Search" />

        </div>

      </div>

    </form>

     

    Any suggestions?

     
    |
    Mark as:
  • Liam Dilley
    6,714 posts
    Feb 28, 2012
    Currently Being Moderated
    Mar 14, 2013 1:00 AM   in reply to Spencer_wes

    Have you viewed the console to see what happens when you post so you know what actually is returned with data? , Because it is html you do not need to serilize it. Here is what that does;

    http://api.jquery.com/serialize/

     

    Best question for me is what are you trying to achieve? It hard to understand the goal.

    I can see you are trying to self post to the same page, You can use self page loading to counter some issues but it may be easier for you at first to have the webapp results on another page and change the pageid to id and a specified page and post to that page and only have the results there. Your data will contain the whole html and you can then easily find and filter out the content you want and render it in a div.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 14, 2013 1:13 AM   in reply to Liam Dilley

    Hi Liam,

     

    My objective is to display the relevant shipping details of an item on the Products Detail Page (For example ETA, Shipping Cost, Shipping Method and Return policy).  On the product detail page load i would like to have the customers current country details displayed automatically (using {module_visitorcountrycode}) however maintain the option for the user to change the shipping destination to alternative countries.

     

    I'm hoping too achieve a similar functionality to eBay’s "shipping details" at the end of the day.

     

    When using the demo(http://www.kiph.co.za/catalog_test3.html) select ZA from the dropdown to see the desired response.

     

    Hope this gives you a better understanding of what I'm trying to achieve?

     
    |
    Mark as:
  • Liam Dilley
    6,714 posts
    Feb 28, 2012
    Currently Being Moderated
    Mar 14, 2013 2:37 AM   in reply to Spencer_wes

    Confusing because your doing web apps etc not products and you can achieve shipping options just using attributes on products and css for visitor country selctions and bits of scripts. I etheir mentioned that to you in another thread or someone else.

    You can cut half of what your doing and be a lot more siplistic in implementation and achieve exactly the same as I see it.

    Sorry, bit confused to what your doing.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 16, 2013 12:55 AM   in reply to Liam Dilley

    Hi Liam, the reason I'd like to go with the web app is that I'll be setting up international shipping for a number of countries plus with the web app I can use the same database in the support section and other parts of the site.

     

    I've basically got the web app working fine now (http://www.kiph.co.za/catalog_test3.html ), the only issue now is that when I copy the code into the product details page the form returns a 404 error back form the action url...

     

    I'm not to sure why this is happening but I've got a feeling that I could be the {mo dule_oid} is the page ID rather than the web app ID?

     
    |
    Mark as:
  • Liam Dilley
    6,714 posts
    Feb 28, 2012
    Currently Being Moderated
    Mar 16, 2013 12:32 PM   in reply to Spencer_wes

    Get a default web app submission form and just the action, yours is incorect.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points