Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Unique Survey title

  • mindau
  • mindau's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 5 months ago #171534 by mindau
Unique Survey title was created by mindau
Is there any way to check titles before creating Survey?

I tried to use beforeSurveySave:
Code:
        public function beforeSurveySave()
    {
        $oSurvey =   $this->getEvent()->get('model');
        traceVar($oSurvey->currentLanguageSettings->surveyls_title);
        tracevar("beforeSurveySave");
 
    }
 
 
2018/07/20 16:45:35 [trace] [vardump]):
null
2018/07/20 16:45:35 [trace] [vardump]:
'beforeSurveySave'
 
 
$oSurvey->getLocalizedTitle() does not works too

Unfortunately afterSurveySave gives same results too. I think the problem is that language table is created later.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
6 years 5 months ago #171551 by DenisChenu
Replied by DenisChenu on topic Unique Survey title

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
The topic has been locked.
  • mindau
  • mindau's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 5 months ago #171572 by mindau
Replied by mindau on topic Unique Survey title
Yes, this event works to check title. The problem is that I can not rollback survey creation in this event. Or can I? Now I just added number at the end of title to avoid dublicate titles..
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
6 years 5 months ago #171574 by DenisChenu
Replied by DenisChenu on topic Unique Survey title
I think you can use www.yiiframework.com/doc/api/1.1/CModel#addError-detail

You can try $this->addError('surveyls_title','Title must be unique'); maybe

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
The topic has been locked.
Moderators: holchtpartner

Lime-years ahead

Online-surveys for every purse and purpose