HI
Currently into my application I perform a normal action for every drop down. For instance I have a page which has 5 drop down so it takes time for every consecutive action. So I am thinking to incorporate AJAX methodology for achieving it. Pls help me in doing so with an example.
Regards
Rj`
http://www.asp.net/ajax/ajaxcontroltoolkit/Samples/CascadingDropDown/CascadingDropDown.aspx
Here's an example using jQuery:
http://jsfiddle.net/sje397/sadtA/
This fills in the second drop-down with data from the server based on the selection in the first drop-down. There are comments to explain some of the jsFiddle specifics.
Related
I'm building a page that has a search box that will populate a grid on the same page. There is also a button the user can select to bring up a "window" (JQuery UI "pop-up" in the same page) that lets the user configure said grid.
These are two separate forms but I don't want what was submitted as part of one to undo the other (so when the user submits to change the grid layout the search needs to re-run as well.
I'd rather not store things in session for this since that brings with it its own issues (search results may be large, shouldn't be saved when the page is re-entered later, etc.).
I've considered doing "one large form" (i.e. surrounding all the inputs) for the entire page that is backed by a form backing bean. I would then use which button is clicked to determine the action to take. There will eventually be other buttons on the page as well to add more functionality. This would be similar to how .NET (non-MVC) handles things.
I'm interested in how others may have solved similar challenges. Are there potential issues with my approach that I'm not seeing? Better ways that work with the framework?
What do you mean with:
but I don't want what was submitted as part of one to undo the other
. Are you referring to posting the form and loading the whole page, which in turn will "reset" the other form?
If that is the case I would still keep one page with two forms and make the posts using Ajax (as you may know jQuery makes this a breeze). Upon receiving a response for either call you will need to update the other form accordingly.
Note that you may still have your forms in two separate views if it helps keeping the code clean and then pull their html with Ajax calls into another view. But my point is that at the end I would still keep both in one page since it sounds like they depend on each other so updating one when the other changes may be easier this way,
Let me know if I misunderstood your question.
When testing an ext-js application with Selenium (WebDriver), I have a button that brings up a dialog. The test then fills out some form fields, clicks buttons, etc. The problem is that selenium starts performing these actions before the dialog is fully done building.
I know that I can tell selenium to wait for a specific element to appear, but if I want to generalize the case to "wait for the dialog to finish loading", is there a way to do that?
The short answer is, "No, theres no simple way to do that." to understand why this is so, consider this: How do you define "the whole DOM is loaded?" Is it when the last closing </html> tag is downloaded? When it's parsed and added to the DOM? Is it when the document readyState property is "interactive," "contentReady," or some other value? What about DOM elements added via JavaScript? What if that JavaScript is fired via setTimeout()? What about processing XmlHttpRequests? There is no one-size-fits-all answer to that question that is correct 100% of the time for all use cases.
Waiting for an element is the right approach. Identifying the right element can be challenging when using extJs, because of the generated IDs. I've often found it more effective to use class attributes with that particular JavaScript framework.
Suppose that selected the one value in drop down list, then after selection of value in drop down list same drop down list regenerated again in same JSP Page(as a previous drop down list).
How is to possible? How to do it?
Hard way of doing it
http://jsfiddle.net/daWd9/
Suppose consider that your source dropdown list id is 'list1'. By using document.getElementById('list1') you'll get the details of that element. Then use document.createElement to create a new dropdown list and get the properties from the existing one document.getElementById('list1').
I suppose, you have to select multiple values from same options.
I would have done it using jQuery UI. Please follow the link for demo http://jqueryui.com/demos/autocomplete/#multiple .
Open the link.
Start typing in textbox, options will auto-populate.
You can select one and again start typing.
It will be a good user-friendly solution, in my opinion.
Hope it helps.
There two solutions documented in StackOverflow using AJAX technology
How to call AJAX request on dropdown change event?
How to call AJAX request on dropdown change event?
Please see the above will help you.
By the way I don't understand why you need to
regenerate again in same JSP Page(as a previous drop down list).
I have created a web form. On Click of button, database query would be fired. The Problem is that when user clicks on button twice, query would be fired 2 times. I want to prevent that. Any help?
Take a look here
Struts2 has a built in mechanism for stopping double form submission that works on the server side instead of the client. You may need to add the TokenInterceptor if its not on the defaultStack you're using.
Here is a quick tutorial
If you are happy to use jQuery you could consider using
http://jquery.malsup.com/block/
onclick or onsubmit call $.blockUI();
Some Demos for your reference
http://jquery.malsup.com/block/#demos
The belt and braces approach is to set a JavaScript flag variable when the button is clicked and block subsequent submits "onclick". Then, on the server, implement the "synchronizer token pattern" (you can just Google that term to find out about it).
I'll make this short:
Is there a way / library in Wicket to show an activity indicator? You know, the spinning thing that moves while the user is waiting for something, or is it just a javascript thing?
Thanks for your help.
If this is an ajax operation then you can look at the implementations of IAjaxIndicatorAware. These implementations will show a 'spinner' while the operation is processing.
e.g. IndicatingAjaxButton and IndicatingAjaxLink
You could also look at AjaxIndicatorAppender and alter it your own needs for non ajax things ?
Check here to generate your own 'activity indicator'.
Simply show it when busy & hide it afterwards.
I think this will help
https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=87917
The Javascript and Css must be add in the renderHEad-Method