How can I pre-populate input fields from url parameters?

More
1 year 6 months ago #137654 by holch
holch replied the topic: How can I pre-populate input fields from url parameters?
The created URL is always static. But you can create it dynamically. You will need to read the value for each attribute and create a URL based on what I am show.

Read out the value of your first variable the specific case from your system and add it to the URL like this /num_mec/yourvalue/ and the same for the other 2.

Then it will work. I don't know how you can get the attributes out of your system and how you redirect to Limesurvey. You can pass on attributes to Limesurvey the way I am showing. Now you have to find out how you can read out these variables from your system and create the URL from that.

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds
The following user(s) said Thank You: od

Please Log in to join the conversation.

More
1 year 5 months ago #137710 by od
od replied the topic: How can I pre-populate input fields from url parameters?
Thanks holch.

I think I will get in contact with the team gave support on our software and see if they can help me at no cost :whistle:

I will get back with the solution.

Cheers

Please Log in to join the conversation.

More
1 year 5 months ago #137850 by od
od replied the topic: How can I pre-populate input fields from url parameters?
Hello. I had no support from the external company. So I did changed a few things on my own risk. And it worked. They had the + sign as variables separator, so I changed to & and it worked. Don't ask me why...
I can now call the variables from the URL and fill in the 3 text boxes just fine.

:unsure: But I have 3 issues:
1st - It works the first time, but when I try another patient with different variables the boxes still gets populated with the previous numbers.
I tried to put &newtest=Y on the URL so the result is http://ip/limesurvey/index.php/581474?&newtest=Y but with no luck.
Maybe It has to do with the session? Because to have this working fine I need to sign out of the application every time. If I sign in it works OK.
So it works as 1 patient per session.

2nd - Once I fill in everything and submit the survey and try another patient the screen show a message:
"The previous session is ending.
Your browser reports that was previously used to answer this inquiry . We are restarting the session so you can start from the beginning .
Click here to start the survey"

Anyway of fixing this?

3rd - If I click on the link "Click here to start the survey" the text fields don't get populated as priviously.
No idea why.

Please can you help me?
Cheers.
Attachments:

Please Log in to join the conversation.

More
1 year 5 months ago #137852 by holch
holch replied the topic: How can I pre-populate input fields from url parameters?
How do the URLs look like that you use? the one you are posting above for the newtest part contains no variables that would be passed on, so of course nothing will be written into it.

Did you set cookies to prevent multiple participations? In this case Limesurvey won't allow you to complete another survey, while the cookie is still set.

Try to use an anonymous browser tab/window and see what happens.

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Please Log in to join the conversation.

More
1 year 5 months ago #137870 by od
od replied the topic: How can I pre-populate input fields from url parameters?
See my answers in blue:
How do the URLs look like that you use? the one you are posting above for the newtest part contains no variables that would be passed on, so of course nothing will be written into it.

Actually it passes the variables to the text boxes, this is done by the integration panel on the clinical software.
And it works fine, the only drawback is that the doctor needs to sign in every-time for each patient.
:(

Did you set cookies to prevent multiple participations? In this case Limesurvey won't allow you to complete another survey, while the cookie is still set.

I checked the settings on the survey and the "Set cookie to prevent repeated participation:" is set to NO.
So I changed the settings on the browser to see which cookies are initiated when the applications calls the survey via URL and the following cookies are asking me for permissions:

PHPSESSID with parameters:
Expire = end of session
Secure = NO
3rd Party =NO
Session =YES

YII_CSRF_TOKEN with parameters:
Expire = end of session
Secure = NO
3rd Party =NO
Session =YES

Anything I need to change?


Try to use an anonymous browser tab/window and see what happens.

Did change the IE to start as default with in-private through a registry hack, so when the application call the survey via URL the survey starts in-private and what happens is that:

Fills in the boxes as expected and submit the survey just fine.
Then when the doctor go back to other patient and happens the same thing - the screen show a message:
"The previous session is ending.
Your browser reports that was previously used to answer this inquiry . We are restarting the session so you can start from the beginning .
Click here to start the survey"


Conclusion:
What I tested was that if the doctors login for each patient the survey and text boxes are filled just fine and survey is submitted. Log off and login again for each patient. Everything works one patient at time.
So my gut says is a cookie or a session issue.
Anything I need to change on the PHP code or in the survey conf?

Cheers

Please Log in to join the conversation.

More
1 year 5 months ago #137876 by holch
holch replied the topic: How can I pre-populate input fields from url parameters?
With the "newtest" there should not be such a problem, if you did not set a cookie or use tokens to prevent more than one participation.

Can you post a REAL url created by "your system"?

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Please Log in to join the conversation.

More
1 year 5 months ago #137880 by od
od replied the topic: How can I pre-populate input fields from url parameters?

holch wrote: With the "newtest" there should not be such a problem, if you did not set a cookie or use tokens to prevent more than one participation.

Can you post a REAL url created by "your system"?


Thanks for the reply.
Have a look on the following steps I do:
1st - Log in on the clinical software.
2nd - Opening a patient record.
3rd - Call the survey via URL, the clinical software creates the following URL: http://192.168.10.160/limesurvey/index.php/581474?num_mec=9000&num_pro=56554&num_epi=16000423

The 3 boxes are filled just fine and I can fill and submit the survey. The URL after submission is:
http://192.168.10.160/limesurvey/index.php/581474

4th - Exit the survey

5th - Go back to the clinical soft and click another patient:
URL called: http://192.168.10.160/limesurvey/index.php/581474?num_mec=9000&num_pro=20018&num_epi=16000378
Now shows the message "The previous session is ending.
Your browser reports that was previously used to answer this inquiry . We are restarting the session so you can start from the beginning .
Click here to start the survey"

6th - Once I click "Click here to start the survey" the URL is:
http://192.168.10.160/limesurvey/index.php/581474/lang/pt/newtest/Y

The 3 text boxes are empty.

My workaround is to close session on the clinical software and chose another patiente.
So is one patient per session.

Cheers

Please Log in to join the conversation.

More
1 year 5 months ago #137904 by DenisChenu
DenisChenu replied the topic: How can I pre-populate input fields from url parameters?

od wrote: 3rd - Call the survey via URL, the clinical software creates the following URL: http://192.168.10.160/limesurvey/index.php/581474?num_mec=9000&num_pro=56554&num_epi=16000423

Ask toi the dev to use this one:
http://192.168.10.160/limesurvey/index.php/581474?num_mec=9000&num_pro=56554&num_epi=16000423&newtest=Y

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

More
1 year 5 months ago #138002 by od
od replied the topic: How can I pre-populate input fields from url parameters?
I noticed one thing that can solve my issue.

What I can do already:
I can call the Limesurvey URL from our application and the 3 text boxes are filled just fine.

What I need:
Within the same session fill more than one survey.
I noticed that if I wait at least 60 minutes (can be less, I don't know), I can within the same session (logged in on doctors software) call another patient and the 3 boxes are filled with the new numbers.

So my question is: Maybe I can reduce the session time (sessionid) so it would allow a doctor to within the same session fill more that one survey?
Which file and which parameter should I change?

Cheers

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!