- Posts: 57
- Thank you received: 1
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Pass Array through QuestionAttribute?
- sodiumchl
- Topic Author
- Offline
- Senior Member
Less
More
3 years 6 months ago #207191
by sodiumchl
Pass Array through QuestionAttribute? was created by sodiumchl
I need to pass an array of strings from beforeQuestionRender() to newDirectRequest(). What's the proper way of doing this?
I tried the following, but it does not work.
In beforeQuestionRender():
In newDirectRequest():
Now $output is empty. It is not $myArray. What's wrong?
Thank you!
I tried the following, but it does not work.
In beforeQuestionRender():
Code:
QuestionAttribute::model()->setQuestionAttribute($qid, 'myarray', $myArray); log_var($myArray);
In newDirectRequest():
Code:
$aAttributes=QuestionAttribute::model()->getQuestionAttributes($qid); $output = $aAttributes['myarray']; log_var($output);
Now $output is empty. It is not $myArray. What's wrong?
Thank you!
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13637
- Thank you received: 2491
3 years 6 months ago #207200
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Pass Array through QuestionAttribute?
Direct request can use only url params (POST or GET).
You can't really send a param via PHP only.
Add your parameteres directly in the url
You have sample on gitlab.com/SondagesPro/QuestionSettingsType/questionExtraSurvey
(but giltal is broken currently)
You can't really send a param via PHP only.
Add your parameteres directly in the url
You have sample on gitlab.com/SondagesPro/QuestionSettingsType/questionExtraSurvey
(but giltal is broken currently)
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
- sodiumchl
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 57
- Thank you received: 1
3 years 5 months ago #207203
by sodiumchl
Replied by sodiumchl on topic Pass Array through QuestionAttribute?
But in the example, $oAttributeExtraSurvey is passed via QuestionAttribute, right?
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13637
- Thank you received: 2491
3 years 5 months ago #207207
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Pass Array through QuestionAttribute?
There are code, using $qid
Get the qid in URL
Search the attribut using this var
You NEED to pass the variable via url (or session), it's a DIRECT request.
Get the qid in URL
Code:
$qid = $this->api->getRequest()->getParam('qid');
Code:
$oAttributeExtraSurvey=QuestionAttribute::model()->find('attribute=:attribute AND qid=:qid', array( ':attribute' => 'extraSurvey', ':qid' => $qid, ));
You NEED to pass the variable via url (or session), it's a DIRECT request.
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.