Welcome to the LimeSurvey Community Forum

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

How to hide "Submit" button after a survey has been done

More
2 weeks 1 day ago #243561 by eavenhuang
Please help us help you and fill in where relevant:
Your LimeSurvey version:    LimeSurvey Community Edition         Version 6.0.3+230424
Own server or LimeSurvey hosting: Own Server
Survey theme/template: Fruit
==================
Dear Experts,

Our survey has an equation to restrict each custom TicketID that can only be submitted once, this works just fine for me. However, when the user clicked the URL the second time and he sees "this ticket has been submitted, you can't do it again", there is still "Submit" button on the right, which makes no sense. Users can still click it and that looks also meaningless.

How can we hide it from such scenario?
Thanks.

Please Log in to join the conversation.

More
2 weeks 1 day ago #243562 by Matadeleo
Are you able to provide a copy (.lss file) of your survey?

Please Log in to join the conversation.

More
2 weeks 1 day ago - 2 weeks 21 hours ago #243563 by Matadeleo
It's not exactly the most.. robust.. solution but you could do something like adding the following to the source code in the help section of your equation.

Edit: Updated hide() to remove()

Code:
<script type="text/javascript" charset="utf-8">
    $(document).on('ready pjax:scriptcomplete',function(){
        
        if ($('body:contains("This ticket has been submitted, you can\'t do it again")').length > 0) {
            $("#ls-button-submit").remove();
        }
    });
</script>
Last edit: 2 weeks 21 hours ago by Matadeleo. Reason: Edited to update with tpartner suggestion

Please Log in to join the conversation.

More
2 weeks 1 day ago - 2 weeks 1 day ago #243564 by Joffm
So you do not set a quota on this equation to screen out?
Seems to be a better and cleaner way.

Joffm 

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 2 weeks 1 day ago by Joffm.

Please Log in to join the conversation.

More
2 weeks 21 hours ago #243572 by tpartner
Yes, I think a quota would be better but if you use Matadeleo's solution, I would modify it to this so the submit can't be triggered via the tab key.
Code:
$("#ls-button-submit").remove();

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: Matadeleo

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose