- ZackSpearAsked on October 09, 2015 at 11:28 AM
Hey, I have a form created where I needed to move the inputs around with some custom coding so I needed to take the source code and put it on my server. What I am now trying to do is send the edit link for the form to my server to show the styled form vs sending them to jotform to see the un-styled form. So I know the edit link wont really work for this so Im looking for a slightly different method.
On this forum post http://www.jotform.com/answers/462462-Edit-link-on-embedded-form they were sort of getting into this but I think it only works on embedded forms and not source code.
I was thinking I could somehow store all the variables then create my own link combining all the saved inputs parsing them to back to my form on the server. Im sure there might be a better way though.
Form on Jotform: https://form.jotform.com/52745527138965
Form on my dev server : http://icsbuilds.net/static_files/nbnu.ca/expense-form-en/
- CharlieAnswered on October 09, 2015 at 02:15 PM
Currently, it is possible to do this by simply following the guide on the shared link you have, it is actually a guide I made over a year ago. I noticed that I may have deleted the form which is why the sample links are not working, I restored the form so you can check it out how it looks like.
Regarding the question you have, I'm not sure if it will work on a full source code of the form, but let me test it in my end. But it should be possible by changing the "action" link
However, I'm not quite sure about it, I will need to test it out in my end to confirm if this will work.
If you are familiar with API or you want to try it out, you can easily update the submission using that one. Here's a guide that you can follow: http://api.jotform.com/docs/#post-submission-id
- CharlieAnswered on October 09, 2015 at 02:32 PM
Unfortunately, this is not possible, this is because the full source code is hard coded in your web page which is why it will not automatically load existing submissions on those input fields even if we used the edit link.
Currently, I am not able to find a workaround for this using this approach, full source code was designed to submit a new submission, and changing the "action" link will just redirect the user to the edit link instead of submitting it.
There's two ways that I can think of that this can be done, but with a different approach:
What I think is possible is using the API, here's how I will do it in my end:
1. I will create an HTML form, this is not built in JotForm, it will be a form that will be dedicated for editing submissions, the design of it is purely on HTML. It's possible to use the form's full source code but it might be a tricky part on how to submit it.
2. I will populate the input fields by using an API call, here's how: http://api.jotform.com/docs/#submission-id.
3. Using that, the existing submission can be loaded, I will then use the API to update the submission. Here's a reference for that: http://api.jotform.com/docs/#post-submission-id
Same with Method 1, but instead of getting the existing submissions using the API, we will directly store the submissions on your own server. Here's how you can store them on a MySQL server using PHP: http://www.jotform.com/help/126-How-to-send-Submissions-to-Your-MySQL-Database-Using-PHP
You can then fetch the submissions stored in your MySQL to an HTML form to prepopulate the fields. You can then again use the API call to update the submission.
So far those are the alternatives that I can see on how you can load the submissions and update them.
I hope that helps.
- ZackSpearAnswered on October 13, 2015 at 09:37 AM
Ok Ill give both options a try then. Thanks for your time, I appreciate it!
- CharlieAnswered on October 13, 2015 at 10:56 AM
I'm glad to be of a help :)
Should you need any assistance again, please do not hesitate to open a new thread here in the forum.
- ZackSpearAnswered on October 15, 2015 at 02:51 PM
Hey Charlie, wasnt sure whether or not to start a new thread or not as this question is related to the above. Iv gotten the edit code working by creating the edit.php file on my server. Im appending the submission id to the url and calling the api to grab the submission data. With jquery Im then throwing the data to the proper fields. Im using the source still from the original form.
The issue I am now experiencing is that my conditional logic and also my calculations are not working unless I focus on all the inputs and then tab away from them. Then either the calculations the work and then also the show/hide conditions work.
Here is a test example below:
If you put your cursor on section one Date for MON and then tab over through all the days you will see that once you move through the fields the show/hide then works and then the calculations show afterwards. I don't see any other conflicts in the console so perhaps you have an idea?
- BenAnswered on October 15, 2015 at 05:11 PM
Unfortunately you seem to have blocked my country so I am not able to see it in action :)
Looking from the start and what my colleague has mentioned, the API would have been my suggestion as well.
Now in regards to what you have explained (and without being able to verify that) my thought are that you are actually getting the data back and that there are no issues, but since conditions require a change to be fired, that is likely the reason why you are experiencing the same.
To go around it, you would need to fire the calculations "manually" - through JS.
To do that, you should call:
JotForm.runAllCalculations(false); //You can try with "true" as well to see which one works best for you
Do let us know how it goes.
- ZackSpearAnswered on October 16, 2015 at 10:22 AM
Awesome, that worked perfectly. Thanks so much. I never figured to call those functions so that saved me a ton of time. Thanks again.
- CharlieAnswered on October 16, 2015 at 11:36 AM
I'm glad to hear the suggestion of my colleague, Ben, helped. :)
If you need more assistance on this, please let us know and we'll be more than happy to help.