Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 35

Thread: ajax submit, forward if successful, show errors on fail

  1. #21
    Join Date
    Sep 2006
    Posts
    4

    Default

    Hello there,


    First of all, thanks for your help.

    [QUOTE=sbtourist;97917]
    What kind of browser are you using? Have you tried with a different one?
    [QUOTE]

    I have tried with IE 6.0 and Firefox 1.5.0.9. With IE i got an error message "Object is required" and with Firefox nothing happens

    I tried changing some lines in springxt.js in order to cath the ResponseText instead of ResponseXML, I also change my html code, I added a div to get the ResponseText. When I did that, error message disappered but I got no answer, it seems it never got the "complete" state (state number 4).

    I am complete cluless, any idea will be so appreciated.

    LJ.

    P.D. Just in case, I am sending como of code I am using. (with the original form of springxt.js -catching ResponseXML-)

    This is my html page:

    <form name="form1" id="form1" method="post" action="">
    <input name="button" type="button" onclick="JavaScript:XT.doAjaxAction('loadOffices', this);" value="Press" />
    <div id="divTest">
    <select name="select" id="offices">
    <option>--- ---</option>
    </select>
    </div>
    </form>

    This is my loadOffices method:

    public class AjaxHandler extends org.springmodules.xt.ajax.AbstractAjaxHandler{
    public AjaxResponse loadOffices(AjaxActionEvent event){
    Collection<String> offices = new Vector<String>();
    offices.add("One");
    offices.add("Two");
    offices.add("Three");
    List<Component> options = new LinkedList<Component>();

    Option first = new Option("-1", "Select one ...");
    options.add(first);

    for(String office : offices) {
    Option option = new Option(office, "officeId", "name");
    options.add(option);
    }
    ReplaceContentAction action = new ReplaceContentAction("offices", options);
    AjaxResponse response = new AjaxResponseImpl();
    response.addAction(action);
    return response;
    }
    }

    This is part of my dispatcher :

    <bean id="ajaxLoadOfficesHandler" class="controller.AjaxHandler">
    </bean>

    <bean id="ajaxInterceptor" class="org.springmodules.xt.ajax.AjaxInterceptor">
    <property name="handlerMappings">
    <props>
    <prop key="/ajax/tutorial.html">ajaxLoadOfficesHandler</prop>
    </props>
    </property>
    </bean>

    <bean id="urlMapping" class="org.springframework.web.servlet.handler.Sim pleUrlHandlerMapping">
    <property name="interceptors">
    <list>
    <ref bean="ajaxInterceptor"/>
    </list>
    </property>
    <property name="mappings">
    <props>
    <prop key="/**/*.html">staticViewController</prop>
    <prop key="/action/*.action">eventController</prop>
    </props>
    </property>
    </bean>

  2. #22
    Join Date
    Jul 2006
    Location
    Rome, Italy
    Posts
    347

    Default

    Quote Originally Posted by ljgarcia View Post
    I have tried with IE 6.0 and Firefox 1.5.0.9. With IE i got an error message "Object is required" and with Firefox nothing happens
    Hi,

    sorry for the late reply, I've been very busy.

    Can you attach a zip containing code that reproduces the error, so that I can give it a try?

    Cheers,

    Sergio B.
    Sergio Bossa
    Spring Modules Team

  3. #23
    Join Date
    Jun 2007
    Posts
    6

    Default Hi I am having the same problem - Obect required in IE

    Hi, I am using AjaxSubmit to submit a form with the input bound to my spring tags.


    The request gets sent okay but the responseXml is null in Internet explorer, however, in Firefox everything is fine - the lines of code below appear to be where the IE script error exception:

    //handle null responseXML
    var nodes = null;
    if (ajaxRequest.getXMLHttpRequestObject().responseXML != null) {
    nodes = ajaxRequest.getXMLHttpRequestObject().responseXML. documentElement.childNodes;
    } else {
    nodes = new Array();
    }

    I have the latest version from the CVS.

    Do you have any suggestions?

    Sergio - Did you find out what the roblem was with the code above?

    This problem is ruining my year.

    Many thanks - John


  4. #24
    Join Date
    Jul 2006
    Location
    Rome, Italy
    Posts
    347

    Default

    Quote Originally Posted by buster View Post
    The request gets sent okay but the responseXml is null in Internet explorer, however, in Firefox everything is fine - the lines of code below appear to be where the IE script error exception:
    [CUT]
    Hi John,

    it should be a problem with your XML response to be not well formed.
    So can you post the XML response sent by the server (just configure log4j at DEBUG level and take it from your logs)?

    Thanks,
    Cheers,

    Sergio B.
    Sergio Bossa
    Spring Modules Team

  5. #25
    Join Date
    Jun 2007
    Posts
    6

    Default XML sample

    Here is a sample ofthe xml response from the server log - the xml is null if the"`" character is present in the xml string.


    22 Jun 2007 11:15:35 - INFO [org.springmodules.xt.ajax.AjaxInterceptor] - <Pre-handling ajax request for event: showLoading>
    22 Jun 2007 11:15:35 - DEBUG [org.springmodules.xt.ajax.AbstractAjaxHandler] - <Event supported by method: public org.springmodules.xt.ajax.AjaxResponse reporting.web.ajax.TransactionHandler.showLoading( org.springmodules.xt.ajax.AjaxActionEvent)>
    22 Jun 2007 11:15:35 - INFO [org.springmodules.xt.ajax.AbstractAjaxHandler] - <Invoking method: public org.springmodules.xt.ajax.AjaxResponse reporting.web.ajax.TransactionHandler.showLoading( org.springmodules.xt.ajax.AjaxActionEvent)>
    22 Jun 2007 11:15:35 - INFO [org.springmodules.xt.ajax.AjaxInterceptor] - <Sending Ajax response after Ajax action.>
    22 Jun 2007 11:15:36 - INFO [org.springmodules.xt.ajax.AjaxInterceptor] - <Post-handling ajax request for event: validate>
    22 Jun 2007 11:15:36 - DEBUG [org.springmodules.xt.ajax.util.InternalAjaxRespons eSender] - <Sending ajax response: <?xml version="1.0"?> <taconite-root xml:space="preserve"> <taconite-execute-javascript parseInBrowser="true"><script type="text/javascript">Element.hide('pageResultsContainer');</script></taconite-execute-javascript><taconite-execute-javascript parseInBrowser="true"><script type="text/javascript">Element.show('loading');</script></taconite-execute-javascript> </taconite-root>>
    22 Jun 2007 11:15:36 - DEBUG [org.springmodules.xt.ajax.AbstractAjaxHandler] - <Event supported by method: public org.springmodules.xt.ajax.AjaxResponse org.springmodules.xt.ajax.validation.DefaultValida tionHandler.validate(org.springmodules.xt.ajax.Aja xSubmitEvent)>
    22 Jun 2007 11:15:36 - INFO [org.springmodules.xt.ajax.AbstractAjaxHandler] - <Invoking method: public org.springmodules.xt.ajax.AjaxResponse org.springmodules.xt.ajax.validation.DefaultValida tionHandler.validate(org.springmodules.xt.ajax.Aja xSubmitEvent)>
    22 Jun 2007 11:15:36 - DEBUG [org.springmodules.xt.ajax.util.InternalAjaxRespons eSender] - <Sending ajax response: <?xml version="1.0"?>
    <taconite-root xml:space="preserve">
    <taconite-replace-children contextNodeID="transactionTable" multipleMatch="false" parseInBrowser="true">
    <tr>
    <td nowrap="nowrap" class="merchantIdCol">30644</td>
    <td nowrap="nowrap" class="clientCol" id="client">6132</td>
    <td nowrap="nowrap" class="statusCol" id="status">Successful</td>
    <td nowrap="nowrap" class="dateCol" id="date">22/06/07 11:04</td>
    <td nowrap="nowrap" class="authIdCol" id="authid">32161782</td>
    <td nowrap="nowrap" class="typeCol" id="type">S</td>
    <td nowrap="nowrap" class="cardTypeCol" id="cardtype">Visa</td>
    <td nowrap="nowrap" class="amountCol" id="amount">1,333.40</td>
    <td nowrap="nowrap" class="currencyCol" id="currency">xxx</td>
    <td nowrap="nowrap" class="clientRefCol" id="clientref">94e94bc5-3231-4d7d-b906-6d4b52f920c8</td>
    <td nowrap="nowrap" align="left" class="cardNumberCol" id="cardnumber">XXXXXXXXXXXxxxxx</td>
    <td nowrap="nowrap" class="cardNameCol" id="cardname"> Vladimír Popík</td>
    <td nowrap="nowrap" class="clientNameCol" id="clientName">SkyEurope Airlines E SKK</td>
    <td nowrap="nowrap" class="refundIdCol" id="refundid">null</td>
    </tr>
    </taconite-replace-children><taconite-replace-children contextNodeID="transactionsCount" multipleMatch="false" parseInBrowser="true">1</taconite-replace-children><taconite-replace-children contextNodeID="countSales" multipleMatch="false" parseInBrowser="true">1</taconite-replace-children><taconite-replace-children contextNodeID="countRefunds" multipleMatch="false" parseInBrowser="true">0</taconite-replace-children><taconite-replace-children contextNodeID="countSuccessful" multipleMatch="false" parseInBrowser="true">1</taconite-replace-children><taconite-replace-children contextNodeID="countDenied" multipleMatch="false" parseInBrowser="true">0</taconite-replace-children><taconite-replace-children contextNodeID="countFailed" multipleMatch="false" parseInBrowser="true">0</taconite-replace-children><taconite-replace-children contextNodeID="amountsPerCurrency" multipleMatch="false" parseInBrowser="true"><tr><td>Total SKK</td><td width="10px"> </td><td align="right">1,333.40</td></tr></taconite-replace-children><taconite-replace-children contextNodeID="cardTypeSelect" multipleMatch="false" parseInBrowser="true"><option value="" selected="true">All</option><option value="Delta">Delta</option><option value="MasterCard">MasterCard</option><option value="Amex">Amex</option><option value="Visa">Visa</option><option value="UK Electron">UK Electron</option><option value="Duet">Duet</option><option value="Solo">Solo</option><option value="JCB">JCB</option><option value="Maestro">Maestro</option><option value="Switch">Switch</option></taconite-replace-children><taconite-replace-children contextNodeID="currencySelect" multipleMatch="false" parseInBrowser="true"><option value="" selected="true">All</option><option value="EUR">EUR</option><option value="ZAR">ZAR</option><option value="PLN">PLN</option><option value="SKK">SKK</option><option value="GBP">GBP</option><option value="HUF">HUF</option><option value="CZK">CZK</option><option value="CYP">CYP</option><option value="DKK">DKK</option><option value="CHF">CHF</option><option value="USD">USD</option><option value="CAD">CAD</option></taconite-replace-children><taconite-replace-children contextNodeID="pageNumber" multipleMatch="false" parseInBrowser="true">1/1</taconite-replace-children><taconite-replace-children contextNodeID="navigation" multipleMatch="false" parseInBrowser="true"> </taconite-replace-children><taconite-execute-javascript parseInBrowser="true"><script type="text/javascript">traverseTable();</script></taconite-execute-javascript><taconite-replace-children contextNodeID="error.all" multipleMatch="false" parseInBrowser="true"></taconite-replace-children><taconite-execute-javascript parseInBrowser="true"><script type="text/javascript">Element.hide('loading');</script></taconite-execute-javascript><taconite-execute-javascript parseInBrowser="true"><script type="text/javascript">Element.show('pageResultsContainer');</script></taconite-execute-javascript> </taconite-root>>

    In firefox the "`" character is replaced with a unknown character icon. Maybe I should change the character encoding of my xhtml doc (currently utf-32)

    Any help is much appreciated!

    - John

  6. #26
    Join Date
    Jul 2006
    Location
    Rome, Italy
    Posts
    347

    Default

    Quote Originally Posted by buster View Post
    the xml is null if the"`" character is present in the xml string.
    Well, just try to set your encoding through the AjaxResponse object, and/or try using the character entity number: http://www.w3schools.com/tags/ref_entities.asp

    Let us know.
    Cheers,

    Sergio B.
    Sergio Bossa
    Spring Modules Team

  7. #27
    Join Date
    Jun 2007
    Posts
    6

    Default Hi Sergio - I will do that but

    I updated to the latest version of XT from the CVS and I have another IE (v6/7) problem - I get an error when the js libraries load. "Document is not defined" in springmin-xt.js on line x

    If I change Document to lowercase "d" - document, then I get and uncaught exception error instead in IE.

    Please can you help?

    Many thanks - John

  8. #28
    Join Date
    Jun 2007
    Posts
    6

    Default Please ignore last post

    Hi Sergio - I have update springmin-xt.js and spring xt.js files from the link below and the issue has been removed.

    https://springmodules.dev.java.net/s..._with_tag=HEAD

    I will write some code to change the "`" character as you suggested. I will let you know how this turns out.

    Many Thanks- John

  9. #29
    Join Date
    Jul 2006
    Location
    Rome, Italy
    Posts
    347

    Default

    Quote Originally Posted by buster View Post
    I updated to the latest version of XT from the CVS and I have another IE (v6/7) problem - I get an error when the js libraries load. "Document is not defined" in springmin-xt.js on line x
    Quite strange, I don't get any error here with IE6 (I don't have an IE7 installation right now).
    Can you attach the springxt js files you are using?
    Sergio Bossa
    Spring Modules Team

  10. #30
    Join Date
    Jul 2006
    Location
    Rome, Italy
    Posts
    347

    Default

    Quote Originally Posted by buster View Post
    Hi Sergio - I have update springmin-xt.js and spring xt.js files from the link below and the issue has been removed.

    https://springmodules.dev.java.net/s..._with_tag=HEAD

    I will write some code to change the "`" character as you suggested. I will let you know how this turns out.

    Many Thanks- John
    Very good.
    Let us know.
    Sergio Bossa
    Spring Modules Team

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •