Welcome, Guest
Username: Password: Remember me

TOPIC: Passing $_REQUEST data to a prefilled answer field

Passing $_REQUEST data to a prefilled answer field 3 years 10 months ago #50945

  • rofz
  • rofz's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 2
  • Karma: 0
Hi everyone.

I would like to use a survey's URL to pass data to a prefilled answer field.

So, what i need exactly is this:

1 - Send to survey users an URL with an additional parameter, such as &ticket_number=123456
2 - Collect this ticket_number=123456 by using php's $_REQUEST array
3 - Make the HTML 'value' parameter of an answer field just exactly as $_REQUEST

All of the above is relatively easy to code on PHP, but the big problem is: questions and survey's are so dynamic in limesurvey that i don't have any clue on which file must be edited to accomplish that third step (change HTML input default value).

Any ideas would be greatly appreciated.

Thanks
Rofz
Last Edit: 3 years 10 months ago by rofz.
The administrator has disabled public write access.

Re:Passing $_REQUEST data to a prefilled answer field 3 years 10 months ago #50972

  • Mazi
  • Mazi's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 5325
  • Thank you received: 296
  • Karma: 249
You can pass data to a survey question without editing any code. It works similar to the end URL feature, check docs.limesurvey.org/tiki-index.php?page=...ation_amp_Navigation

If you have a short text question with ID 333 in group ID 22 of survey 12345 you can add this to the survey URL:
...&12345X22X333=<ticketnumber>

Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)limesurvey.org'"
The administrator has disabled public write access.

Re:Passing $_REQUEST data to a prefilled answer field 3 years 10 months ago #51033

  • rofz
  • rofz's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 2
  • Karma: 0
Hey Mazi. Thanks a lot, it worked like a charm.
The administrator has disabled public write access.

Re:Passing $_REQUEST data to a prefilled answer field 3 years 10 months ago #51034

  • Mazi
  • Mazi's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 5325
  • Thank you received: 296
  • Karma: 249
You're welcome!

If our hints have been helpful and you enjoy limesurvey please consider a donation to the team .
We do all this in our free time and you don't have to pay a penny for this software.

Without your help we can't keep this project alive.

Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)limesurvey.org'"
The administrator has disabled public write access.

Re:Passing $_REQUEST data to a prefilled answer field 3 years 6 months ago #57952

  • alferx
  • alferx's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 1
  • Karma: 0
Hi all.

What if I would pass the value of an answer (I think it an be called a dynamic value pass) to the survey URL?

In example, if 66462X4X3 is the source value of survey 66462 and I want it to pass as my dynamic <ticketnumber>, I should write something like this:

...&12345X22X333={66462X4X1}
or
...&12345X22X333={INSERTANS:66462X4X1}

But as default value of the 12345X22X333 question, I got respectively
66462X4X1
or
Errore(66462X4X1)

Is it possible to pass dynamic values?
Any help appreciated!

Alferx
The administrator has disabled public write access.

Re:Passing $_REQUEST data to a prefilled answer field 3 years 6 months ago #57957

  • DenisChenu
  • DenisChenu's Avatar
  • OFFLINE
  • Moderator Lime
  • Posts: 6318
  • Thank you received: 810
  • Karma: 242
According to the documentation, you have to use {INSERTANS:66462X4X1}.

But if {INSERTANS:66462X4X1} is not set or is empty, then you have Error({INSERTANS:66462X4X1}) becaus to not have :

index.php?myvar={INSERTANS:66462X4X1}&myvar2={INSERTANS:66462X4X2} becoming

index.php?myvar=&myvar2=

:)

PS : you can use the HTML editor to know exactly the SGQA code.
Last Edit: 3 years 6 months ago by DenisChenu.
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.122 seconds
Donation Image