- GAPTAOnlineAsked on July 04, 2014 at 10:32 AMI have added the ability to add my own checks to prevent the user from going to the next step for instance, if the database doesn't have a matching record for a input item. (You simply add a condition to an array called preventNext, and when the condition is met, then you remove the entry from the array. Then your code (modified) checks if any conditions are set in that array, and if so, then disables the next button (or submit button) until the condition is resolved, giving the user a nice message telling them of the condition.
- JotForm Supportashwin_dAnswered on July 04, 2014 at 11:32 AM
I am not sure if I have understood your question correctly.
I would suggest you to please explain your requirement a bit more in details so that we can forward your request to our back end team. I did try to browse your earlier thread but haven't got the clarity to create a feature request.
When you say "if the database doesn't have a matching record for a input item", do you mean to say you actually want to check the values in your own DB or you want to find it in a list/array or your own form?
We will wait for your response.
- GAPTAOnlineAnswered on July 04, 2014 at 06:38 PM
I mean that the form pulls information from a database and they must choose options that match our records, i.e. a required field. Yet I could not do it with your system because the Choose an Option element was being allowed as a valid selection. So I added a check to see if the drop down still was on that element and if so, then it would keep the user from continuing.
There are other use cases for more complex problems regarding database checks that other users may have and for other forms that I may need in the future that would also be a problem in the future. Say for instance, someone wanted to check a field against their database, for instance, some locations may not allow a product to be purchased, or they may implement a couponing system that is more complex than just allowing a certain code to be entered.
I haven't looked at your coupon system, so I don't know if it can do this, but for some of my other clients I have had some pretty unique coupon schemes asked to be put in place and I've yet to run across a system that implements anything close to their requirements (for example, coupon numbers being generated in advance in batches, downloaded into their on-site pos with the ability for those same coupons to be available online, but once a coupon is used, it is removed from both systems.)
Another use case could be to enable additional required fields based on the selected option, say if they chose to purchase a computer and they select that they want a custom graphics card, then another drop down populated from a database for the type of card would then become required.
I have posted all my custom code in a public question as requested by one of your staff. For security purposes, I generalized it to say option and special data in place of my actual options, and I used place holders for my sensitive database login information, but it is the full code.
- GAPTAOnlineAnswered on July 04, 2014 at 06:46 PM
To better answer your question directly, both on form and database. The checks could require ajax database requests against another server/form/api, or be pulled from the database to be populated into an array/drop down/object.
I work with many third party apis that limit interactions to their databases through the api calls which would require another page request to a server to get the information. Pretty advanced stuff, but even some of the simpler database integrations could benefit from the changed code to allow better information checks prior to submission.
For obvious reasons, if you have a large number of correlated fields, or a large record set, you can't copy the information into the form, but must use a database integration on the embedded form.
- JotForm SupportjonathanAnswered on July 04, 2014 at 07:05 PM
I have read thoroughly the details of your latest post and try to understand them as much as possible. Since, for me it seem it was about a higher level of programming knowledge, and more so on database programming -- I am a bit overwhelm.
So, I may not be able to fully provide you with a suggestion or appropriate response about them.
BUT one thing I do understand clearly, and its very evident from start -- is that the feature you were trying to suggest was actually for a custom solution.
As is now, to what I know so far, JotForm do not have the feature or capability yet to pull data from external data source (i.e. databases) and pre-fill the input fields in the form.
You were only able to do it on your end because you have a customize solution for it.
What I am trying to get at is, maybe we should focus the request first on the feature to have apps/solution/or even widget that will give the form the capability to pull data from outside datasource -- done thru integration or database connections.
If this capability is in place, then we can focus next on the logical options (i.e. prevent from going to next step if there is no connection/integration...)
Please tell us your thought on this.
- GAPTAOnlineAnswered on July 04, 2014 at 07:40 PM
Exactly. It is a custom solution and I already fixed it so it works for me.
I included the code for you (and other advanced users) because I already set up a simple mechanism for preventing the next page by modifying your jotform.js code in three places. Two simple if statements and a single array. To complete the solution I also added two more if statements to allow an on JotForm ready function to be defined. If it isn't defined, the if statement is false, and so doesn't try and execute the non-existent function, but if it is defined, then that function is called. This is for the auto fill (saved form). If you are going to populate fields from a database, then you need to perform your checks only after JotForm has loaded the fields from the saved form.
This code is ready for users if your team can check it to make sure my implementation doesn't cause any other side effects. The reason the thread was split was probably for the creation of a database widget.
- JotForm SupportEltonCrisAnswered on July 04, 2014 at 09:57 PM
That's way too kind of you. Thank you for sharing your custom solution with us. We will definitely recommend this to every users who are seeking for similar functions.