Git Product home page Git Product logo

Comments (7)

Bpola005 avatar Bpola005 commented on July 29, 2024 1

I have a cshtml page in which I want to incorporate surveyJS, I used @Sections. However the code is still not called. Please help!!

from surveyjs-aspnet-mvc.

tsv2013 avatar tsv2013 commented on July 29, 2024

Unfortunately right now our team doesn't have spare resources to create such an example - the whole client jQuery application. But you can study live demos on our site - https://surveyjs.io/form-library/examples/nps-question/jquery
Not that some our libraries are under commercial license.

from surveyjs-aspnet-mvc.

ridingmower avatar ridingmower commented on July 29, 2024

Hello the sample here is convoluted to understand.

For the benefit of the community, showing a simple MVC View and Controller would go a long way.

from surveyjs-aspnet-mvc.

tsv2013 avatar tsv2013 commented on July 29, 2024

What would you like to see in these view/controller pair?

from surveyjs-aspnet-mvc.

ridingmower avatar ridingmower commented on July 29, 2024

Hello and thanks for looking into it.

Please start with 2 simple Views, showing how to incorporate SurveyJs in ASP mvc core - simple JavaScript/jQuery/ts/razor

  • CreateSruveyView: One view for showing how users can create and save surveys, edit update etc. inside asp Views (Razor) for e.g. if you recommend _Layouts or ViewComponents or PartialViews or something very basic. to add surveyjs easily into the web app.
  • TakeSurveyView: Another view to show how to render surveys to allow people to take surveys and save results. Sometime anonymous and other times logged in user, so either are fine.
  1. In both these, please do add steps/comments in the code to explain where/how the JSON structure is going back and forth
  2. Allow backend developers to easily swap out the different form/survey components you have, for e.g. difference between a ifThen Question vs basic question in survey
  3. Many ASP developers are not frontend, they are backend C#, so this is ideal if its easy to use from a backend integration & CRUD

Hopefully this helps, but when I use bootstrap it fails..


@{
    ViewData["Title"] = "SomeTest_TextEditor";
}

<div class="wrapper wrapper-content">
    <div class="row">
        <div class="col-lg-12">
            <div id="surveyContainer">
                <div id="editorElement"></div>
            </div>
        </div>
    </div>

</div>


@section Styles {
  <link href="~/lib/surveyjs/dist/css/select2.min.css" rel="stylesheet" />
<link href="~/lib/surveyjs/dist/css/surveyeditor.css" type="text/css" rel="stylesheet" />
// I was not able to get bootstrap to work

    <style>
        #page-wrapper > div.wrapper.wrapper-content > div > div {
            padding-left: 0 !important;
            padding-right: 0 !important;
        }
        #page-wrapper > div.wrapper.wrapper-content{
            padding: 0px 0px 20px 0px !important;
        }
        #editorElement > div > div.panel.svd_content,
        .svd_container .svd_content .svd_survey_designer .svd_toolbox,
        .svd_container .svd_content .svd_survey_designer .svd_toolbox .btn-group-vertical .btn,
        #surveyjsExample > div > div.panel-footer,
        #page-wrapper{
            background-color: white !important;
        }
    </style>

}
@section Scripts {
    <environment names="Development,Staging,Productio">
        <script src="~/lib/surveyjs/dist/js/knockout-min.js"></script>
        <script src="~/lib/surveyjs/dist/js/survey.ko.js"></script>
        <script src="~/lib/surveyjs/dist/js/ace.min.js" type="text/javascript" charset="utf-8"></script>
        <script src="~/lib/surveyjs/dist/js/worker-json.js" type="text/javascript" charset="utf-8"></script>
        <script src="~/lib/surveyjs/dist/js/mode-json.js" type="text/javascript" charset="utf-8"></script>

        <script src="~/lib/surveyjs/dist/js/select2.min.js"></script>
        <script src="~/lib/surveyjs/dist/js/surveyeditor.js"></script>
    </environment>


<script type="text/javascript">
    Survey.Survey.cssType = "bootstrap";
    Survey.defaultBootstrapCss.navigationButton = "btn btn-green";
    var editorOptions = { questionTypes: ["text", "checkbox", "radiogroup", "dropdown"], showJSONEditorTab: false, showPropertyGrid: false };
    var editor = new SurveyEditor.SurveyEditor("editorElement", editorOptions);
    //Add all countries question into toolbox
    editor.toolbox.addItem({
        name: "countries",
        isCopied: true,
        iconName: "icon-default",
        title: "All countries",
        json: { "type": "dropdown", optionsCaption: "Select a country...", choicesByUrl: { url: "https://restcountries.eu/rest/v1/all" } }
    });
</script>
}

from surveyjs-aspnet-mvc.

ridingmower avatar ridingmower commented on July 29, 2024

if you share a link I can try and help

from surveyjs-aspnet-mvc.

ridingmower avatar ridingmower commented on July 29, 2024

Hello can you add sample ASP Razor or Blazor Views please

from surveyjs-aspnet-mvc.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.