Note that there are some explanatory texts on larger screens.

plurals
  1. POwicket highlight inputs on error
    text
    copied!<p>In my other question, I described a little my form: <a href="https://stackoverflow.com/questions/8212055/wicket-1-5-not-found-error-message">wicket 1.5 not found error message</a> Not I'm trying to do little thing: highlighting an input on error in AjaxSubmit. The code looks like this:</p> <pre><code> add( new AjaxSubmitLink( "save", this ) { private static final long serialVersionUID = 1L; @Override protected void onSubmit( AjaxRequestTarget target, Form&lt;?&gt; form ) { user.setCryptedPassword( CypherUtil.encodeMd5( getNewPassword() ) ); userManager.saveOrUpdate( user ); // close popup modalWindow.close( target ); } @Override protected void onError( AjaxRequestTarget target, Form&lt;?&gt; form ) { /** * Do podswietlania formow */ String jQueryString = ""; if( oldPassFeedbackPanel.anyErrorMessage() ) { jQueryString += "jQuery('mp-oldpass').css({ 'background' : '#E41D1D' });"; } if( newPassFeedbackPanel.anyErrorMessage() ) { jQueryString += "jQuery('mp-newpass').css({ 'background' : '#E41D1D' });"; } if( newPassRepeatFeedbackPanel.anyErrorMessage() ) { jQueryString += "jQuery('mp-newpassrepeat').css({ 'background' : '#E41D1D' });"; } target.appendJavaScript( jQueryString ); target.add( oldPassFeedbackPanel ); target.add( newPassFeedbackPanel ); target.add( newPassRepeatFeedbackPanel ); } } ); </code></pre> <p>It returns error message for the form, but even though the javascript is appended (Wicket Ajax Debug console shows it it appended) the background of inputs is not changed, any idea why? The HTML part of the code looks like this:</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt; &lt;/head&gt; &lt;body class="stats-popup-body"&gt; &lt;div class="stats-popup" id="car-info-edit-popup"&gt; &lt;p class="popup_title"&gt; Edytuj Profilu &lt;/p&gt; &lt;form wicket:id="profileModifyForm" class="stats-popup-form"&gt; &lt;div&gt; &lt;label class="popup_field_label"&gt;Stare hasło:&lt;/label&gt; &lt;input id="mp-oldpass" type="password" wicket:id="mp-oldpass" /&gt; &lt;span class="old_pass_error" wicket:id="mp-oldpass-error" /&gt; &lt;/div&gt; &lt;div class="clear9"&gt;&lt;/div&gt; &lt;div&gt; &lt;label class="popup_field_label"&gt;Nowe hasło:&lt;/label&gt; &lt;input id="mp-newpass" type="password" wicket:id="mp-newpass" /&gt; &lt;span class="new_pass_error" wicket:id="mp-newpass-error" /&gt; &lt;/div&gt; &lt;div class="clear9"&gt;&lt;/div&gt; &lt;div&gt; &lt;label class="popup_field_label"&gt;Powtórz nowe hasło:&lt;/label&gt; &lt;input id="mp-newpassrepeat" type="password" wicket:id="mp-newpassrepeat" /&gt; &lt;span class="new_pass_repeat_error" wicket:id="mp-newpassrepeat-error" /&gt; &lt;/div&gt; &lt;div class="clear9"&gt;&lt;/div&gt; &lt;div class="clear1"&gt;&lt;/div&gt; &lt;div class="button-box-bottom"&gt; &lt;input class="btn btn_save" style="margin-right: 9px;" wicket:id="save" type="button" value="Zatwierdź" onmousemove="this.className='btn btn_save btn_hover'" onmouseout="this.className='btn btn_save'" /&gt; &lt;input class="btn btn_cancel" wicket:id="cancel" value="Anuluj" type="button" onmousemove="this.className='btn btn_cancel btn_hover'" onmouseout="this.className='btn btn_cancel'" /&gt; &lt;/div&gt; &lt;div class="stats-popup-close-x" wicket:id="close-x"&gt;&lt;/div&gt; &lt;/form&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload