I'm developing an InfoPath form for Forms Services. It has these views:
View 1 asks the user to input some basic initial data
View 2 calls a web service based on data in View 1 and populates drop-downs accordingly
At the bottom of View 1 I've added a Next > button to move to View 2. As part of clicking that button I would like the inputs in View 1 to be validated first. However, there don't appear to be any rules that validate a view or anything in the object model to execute validation rules.
Is there code that can trigger a field's validation event?
The answer to this, at least for InfoPath 2007 (which this question is targeted at), is no. The only solution is to handle all validation manually.
Related
We are using VMware clarity wizard to render wizard pages dynamically and we need to have custom logic to access the current page id/step id of the wizard for validation and other functionalities.
When trying to access page of the wizard, using pagesCollectionService and navService, we are getting the id's correctly for the first time e.g clr-wizard-page-0, clr-wizard-page-1 etc.
But the Problem is on click of cancel/submit from the wizard, the wizard id's are not getting reset, that is when we again open the same wizard the wizard page id's are in continuation to the previous id's
e.g :clr-wizard-page-4, clr-wizard-page-5 etc.
Is there a way by which we can access the page of the wizard by using any other property.
Note: Wizard pages are dynamically rendered using json
Attaching image : page id's that come up when we open the wizard for second time
enter image description here
Adding more information,
Please find the stackblitz link for more details:
https://clarity-light-theme-v013-phyhyk.stackblitz.io
Here we are rendering wizard pages, driven by config
For every wizard page we are displaying angular dynamic forms, where config contains all the information for the form fields .
Since is being called inside a for loop, we need to have a function where on click of next/back or on click of step of the wizard we should be able to validate the current form fields and store the current form fields value.
I have added (clrWizardCurrentPageChanged)="resetFormValidity()" and on every page change i am trying to retrieve the page id using wizard.currentPage.id, but the id's are not getting reset and when i access the multiple times, i am getting incremental id's : clr-wizard-page-4, clr-wizard-page-5 etc.
We are using the below versions :
"#clr/angular": "0.11.30",
"#clr/icons": "0.11.30",
"#clr/ui": "0.11.30",
Is there any other way where i can determine which page it is currently, so that i can compare that with config and continue with validation and form submission.
The Wizard has a property called currentPage which will tell you the current page. The public methods of the Wizard are at https://v2.clarity.design/wizards under the Wizard Deep Dive section, which might replace the need to inject and use the internal services which aren't meant to be used directly in applications (from what I understood in your message, an isolated demo would help greatly).
#ViewChild() wizard: ClrWizard;
get currentPage() {
return this.wizard.currentPage;
}
I have an infopath form, is there anyway to get this current infopath form and once submit is clicked, have it go to another form or show a different set of fields upon press [submit] ?
Thanks
If what you want to achieve is some kind of multi-step form, you could use views. InfoPath Views allow to display different fields depending on the view, and you can add buttons to navigate from one view to an other. You may also evaluate some rules before switching to an other view (for example to check for mandatory fields).
It is possible to have 2 separate forms on 1 asp mvc webpage, that using value of one (listbox) control ?
e.g.
using(beginForm) {
//form 1
ListBox("name")
//submit etc.
}
using(beginForm) {
//form 2
//submit2 etc.
}
that form 2 knows value of ListBox named "name" placed in first form ?
Nope - you can only send over what is inside that form without some trickery. You could use jQuery to hook into the form post and set the value dynamically based on what is in the other form.
This link describes how to hook the jQuery submit.
http://hasin.wordpress.com/2009/10/01/jqueryhooking-form-submit-and-making-it-an-ajax-request/
In your function you can then synchronize the values - the easiest way is to probably keep this field OUTSIDE of either form, and include one inside of each form. You only change the one outside of the form, and then on submit you would set each form field as such:
$('#txtForm1Field').val($('#txtPlaceHolder').val())
$('#txtForm2Field').val($('#txtPlaceHolder').val())
if you want them named the same thing you will need to select based on a form id first
Also remember you cannot embed forms within each other either.
There are other ways with jQuery (such as via ajax request just insert the value in the form data being posted) but you don't have anything 'by default' with html that would allow this because of the scope of each form.
If you can call the same view (also pass the model) from the post function of the first form then you'll get the data from from the list in the model. A better option would be to create a partial view.
As far as I feel if you pass the model while returning to the view then you'll get the data you require.
what are the possible usage of hiddden field control of VWD in asp.net page
Hidden input fields could be added to a form in order to pass some value when the form is submitted that the user doesn't see and cannot modify using the application interface. They could be useful when you want to persist some values across multiple requests. It's true that in a standard ASP.NET WebForms application their value is quite limited as you already have hidden values holding the View State allowing you to persist values across requests.
Hidden fields can be used to transfer data back to the server from the front-end and also sending data from server to browser. For e.g. you've written a javascript function that needs to do something if the value of a field is x, then you can always create a hidden field and set its value from server; your javascript can pick the value from this and do whatever it wants to do. It's just like a normal text field, the only difference is that it isn't visible on the page.
Asp.Net internally uses hidden fields to send view state data too. When your .aspx page has been rendered, view its source and you'll see asp.net has automatically created a few hidden fields for its own use.
In Asp.Net architecture it is used as 1 of the 8 (client-side) State Management mechanisms.
I have 5 views in my ASP.NET MVC application. Some data were captured from these views and I am navigating through these views using 2 buttons: the Previous and Next buttons.
So I fill the data in View 1 and I go to view 2 and enter the data there and so on.. till View 5.
Now the question is: If I come back again to previous views, how to retain the data entered there in that particular view.
In addition, I want to submit the data from all the 5 views at a time, once I finish entering data to all 5 views.
What is the best way to do it?
I can think of a number of approaches to your issue. You could create a single view with a number of 'panels' which are hidden or revealed depending on which step you are on in the process, like a wizard control. You could try and use a cookie but that's not very clean. Ideally, you embrace the statelessness of the MVC pattern and the fact the View is a view of the Model and update your Model as each page posts back to your Controller and you persist the Model (however you choose) between pages.
Simplicity might lead me to suggest the 'wizard' approach if you don't want to persist anything until the process is complete. I'm certain jQuery could help you out with this solution.
If you only want to submit the content once all pages are filled, you will probably need to store entered data into a cookie on the client machine. You can do this with javascript:
http://www.quirksmode.org/js/cookies.html