Yii2 AJAX Validation upon filling Dynamic Forms - ajax

I am working on a Yii2 Project and I have a widget of dynamic form. My goal is to get the total percentage of all the items from the dynamic form everytime an items is added and check if it equals to 100. I want to do this using AJAX but I am not very familiar with it. Thank you in advance. Here is the screen cap of the page.

Related

How to programmatically load different partial views in same template page in umbraco 7?

Can anyone give me an idea about how to do this? My goal is to build a multi step claim submission form where user need to provide information for different sections. I am using VS2015 and Umbraco 7. Thanks.
In my opinion if you want to do it all from one template, it would be best to use a javascript/jquery solution that hides and shows different sections/divs as needed. These divs can be rendered from the partial views. I'm not sure if this works but maybe if you have one Form and all of these divs underneath it, you only need one form button and just submit at the end (I'm pretty positive this would work as the partial view elements would just be rendered as elements inside the form). But if not the values can be stored either in Jquery Data, or just using hidden variables, etc.

MVC3 order form with multiple items

Im new to MVC3 so please excuse me. I have the following situation: I have a simple order form and each order can have multiple products attached to it. I want this all to be on one form, so the user will be presented with a form to fill out all their information as well as select a product from a drop down list. They can then click "Add Another" and another dropdown list will appear from which they can select another product. My question is how do I access these dynamically created dropdownlist values from the controllers action? I come from Webforms and so am still trying to wrap my head around things.
Any help much appreciated.
Thanks
here is an excellent post for making master detail in mvc.net
http://zahidadeel.blogspot.com/2011/05/master-detail-form-in-aspnet-mvc-3-i.html
also model binding to a list by phil haack is a must read

How to handle nested forms in ASP.NET MVC

I'm trying to build a fairly complex form which as a couple of cascading selects - i.e. the user selects a value in one combo and the other combo is populated according to their first selection.
I've followed a tutorial on how to handle the cascading but the problem I have is that I now have nested forms (the code in the tutorial uses forms inside partial views to POST to a controller action to load the 2nd combo). I have my main form on which I want to collect the input values but also the nexted forms for the cascading select boxes. The problem I have is that the cascading selection doesn't post to the correct controller action, but instead posts to my main (outer) form's action.
I understand this is the correct behaviour for a browser (as nested forms apparently aren't supported) but what's the correct way to implement this?
The correct way is to only have one form. Then use AJAX to populate the cascading drop down list. The are 100s of examples online how to do this with JSON
use this to have multiple submit buttons on one form which each have different controller actions to post to:
http://iwayneo.blogspot.co.uk/2013/10/aspnet-mvc-action-selector-with-list.html
as for cascading stuff - i would focus on populating these without Ajax 1st - then you can worry about adding this sort of flare - if it doesn't work without JS anyway you're in a bad place.
I would have the 1st dropdown populated when you initially load the form and have a "next" button to populate the next dropdown in the cascade. this submit can use the method above to post to an action which then populates the second data set based on the selection of the 1st dropdown.
make sense?
Then how you ajax that after the point is up to you but you'll have a very solid foundation to build up stuff like that as you will have it working in the minimal tech scenario.
w://

get and display data in MVC 3 using Ajax

I have one view page in MVC named as ‘Index’. There are 3 main controls in that view page. For better understanding, take below example as reference.
1. One Dropdown ‘Customer’
2. One Dropdown ‘Project’ (that depends on ‘Customer’)
3. List of Task (that depends on ‘Project’).
Currently first user needs to select ‘Customer’. So based on customer ‘Project’ dropdown data will be fetched from post method of Index and bind that ‘Project’ dropdown. After selecting ‘Project’, List of task will be fetch from post method of Index and bind those tasks. So every time page is loaded again.I want to do it by Ajax form submit.
My problem – those 3 controls are in one view page so I want to return page view using Ajax without using Partial View. Is this possible? If yes then how? Or any other solution so that I am able to display data without reload whole page again.
If u can give me example of such scenario then it will be good.

How to disable the display of validation errors in view (Cakephp)

I have a view which is containing 5 forms submitting separately but to the same model. The aim of this is allow the user to fill all the forms in the same page and be able to quickly compare the values he puts in for each form. Each form has most of the fields in common with another one. If you want a idea of the stuff, imagine that you are a soccer trainer and you want to be able on the same page to set up your team tactics for each half time. So I'll have a HalfTime model with two forms on the same page, one for each half time
So when I submit Halftime 1 form and that the validation fails, the validation errors of HalfTime1 is displayed in HalfTime2 fields too. I would like to be able to disable the validation of one form according if it wasn't submited.
My idea was to send a variable from the controller to the view containing the name/id of the current half time and from this variable, displaying validation errors only in the ccorrect form.
Do you have any idea on how I can disable the display of the validation errors in one field?
Thank you a lot!
Set the error option to false when you use form input. ie:
echo $this->input('Halftime2.title', array('error' => false));

Resources