Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
We are looking for approach to implement shopping-cart that keep shopping items at the bottom of the page, just like CrateAndBarrels
http://www.crateandbarrel.com/family.aspx?c=837&f=28291
The visitor should be able to add shopping item to the cart by clicking the item's "+ Add to Cart" button. From my understanding, for CrateAndBarrel the bottom shopping-cart is indeed a flash object. However, I wish we could find a way to implement this in ajax-fashion if possible.
We are not expert in anyway in web 2.0 stuff and looking for some guide to implement this feature. Our consultant suggest we use frame to implement this though.
If you were me how would you implement this feature ?
A. Plain WebForms page
B. Use Frame or IFrame.
C. HTML and Flash, just like CrateAndBarrel
D. AJAX
Some simple explanation on how those components should collaborate will be appreciated.
I would definately go with AJAX. Look at jquery or one of the other frameworks to help you do most of the work.
I would create a method to draw the bottom panel. This would then be called when the page loads, with an asynchronous call to get the cart contents. When the user adds an item to the cart, you could either refresh the page (which would re-draw the panel) or call an update method to redraw the cart contents.
1) Personally I would use Ajax (and I am pretty sure CrateandBarrel must be doing that, and using Flash just to render the basket) - weirdly although my Firefox is up to date it won't let me use their site in that)
You can then render the basket with an absolutely-positioned DIV at the bottom of the viewport.
You could use a frame, but I think an absolutely positioned DIV would be a better solution.
(2) As Adam Pope says, when an item is added (via Ajax) the basket can be redrawn (maybe a JSON call to get the basket contents?).
And definitely use a javascript framework.
Edit: And remember to let it degrade gracefully for anyone who does not have javascript!
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have a form that uses multiple of the same model. When the user clicks "add item" it creates a new row (in this case a elements of a 'model') to ActiveForm. This is important in cases when you have a form where the amount of items needed to be added are unknown and rather than have the user navigate multiple pages I would like to use one form. I found a way to save these elements but currently my method (I'm using renderAjax()) loses its client validation for the new elements.
I would like to know if anyone has had experience in using ActiveForm and Ajaxing in new form elements from models and still retain client validation.
Thanks in advance.
Not exactly a cookie cutter method like some JS frameworks but this works.
Clone this attr:
$('#someForm').yiiActiveForm('find','id');
Then modify and add to ActiveForm:
$('#someForm').yiiActiveForm('add', cloned_attr);
I'm not exactly sure if I messed something up or if its intended this way but validation is working now.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I am going through a requirement of an ecommerce checkout flow. One of the striking feature is the heavy use of ajax there. For example - there is a page where user can apply gift card. The requirement is to have this functionality in ajax, however - there are many elements in the page that would have to be refreshed once the gift card has been applied to the order (like - removing credit card if it was already there, refreshing total price etc...) I personally feel this is an overkill of using ajax to update MANY portions of page, I rather do a page reload - this keeps the application simple and maintainable. Any thoughts are appreciated.
First, if it's a requirement, you might be stuck with using Ajax, but lets pick this apart any way because there are a few issues at play.
First, I'd focus on the user experience. Often times the immediate feedback of ajax-based updates are going to help the user understand what happened rather than have the full postback and possibly have them end up at the top of the form or otherwise lose focus on the element that they were editing. If you have an automatic postback after an on_change event (or similar) then the user doesn't expect the refresh and can be frustrated. If you want for a click (submit) event and then do all of the validations, the user can be hammered with a ton of errors and hate the experience.
Generally - immediate feedback is good. I'd probably go ajax unless there is a good reason not to.
Another consideration is page load times and how many times you have to send data to/from the server to get the job done. That overhead alone might make it worth using ajax.
Lastly - maintenance. I don't know what framework you're using so I can't comment on that, but in ASP.NET, for example, it's very easy to implement ajax that updates part of a page. I'd actually argue that maintaining this type of an event is easier than handling the entire postback and refresh each time.
Hope this helps give you a few ideas.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 8 years ago.
Improve this question
I am very new to coding but I am striving to maintain a MVC design pattern at all costs!
I have an app whereby a tableview is selected which pushes to a new tableview. The plist and dictionaries are dealt with in the model class and it returns an array which populates the tableview. When one is selected, do I send that information to the controller than make some sort of query to get the next array, because I believe I can't go from view to model? I've heard of NSNotification, should I set that up somehow so that the model 'knows' what is selected?
In your case, it's perfectly fine to pass along the model data directly to the next tableview. In this case, the controller that manages the first tableview is going to pass the model data to the next controller (the one being pushed one if you're using a navigation controller). That's totally fine from an MVC perspective, and a really common way to do this sort of thing.
From an MVC perspective, all the application logic should reside within the controller itself. Now decide for yourself.
What you want to do is not very clear to me though.
ASP.NET MVC noob here
I was writing a quiz application where a user can select her preferences (e.g. difficulty, number of question etc.), and once she hit a submit button - she got a new page with questions.
The preferences are represented as a "Preferences" object, and the questions are IEnumerable of Question.
This all worked well.
Now I decide both parts should be in the same page - and I don't know how to accomplish that:
Should I have a new model class that is a composition of these two parts?
And also - How will I make the "questions" part appear only after the user completed filling up her preferences and clicked a button?
Should I use AJAX?
I also read a little about partial views and RenderSection.. But I really couldn't understand which approach is the most appropriate for my scenario.
So how should I draw two parts of a page, where the second is only displayed after the first is submitted?
Thanks.
How familiar are you with AJAX? If I had to guess I would think a good way to do what you want to do is to have an AJAX call which is linked to an action when the user submits their preferences. The action can then return a partial view which you can have appear on the page without a reload via AJAX.
All,
I have a question regarding Tabbed Panel in Struts2.
If I have a few panels and I want the content on a tab to be updated every five seconds would how would I do this?
Also, I only want the tab which is currently being viewed to update at the given interval. The other tabs should update when selected and then continue t be updated every five seconds until the user selects another.
Can anyone suggest an approach which allow me to do these things?
Thanks,
Alex
There is a long running tradition in Stack Overflow where all Javascript problems can be solved with jQuery.
Here is a similar question with a div instead of a tab
Auto-refreshing div with jQuery - setTimeout or another method?