0

I have build a system which allows clients to complete a questionnaire. in order to complete the questionnaire the user has to enter their unique number which pulls their data from a different database using by a stored procedure.

Anyway what I am trying to do is when the client complete their questionnaire and click on create id like the cell/fieldset to be highlighted so I know which client has completed the questionnaire.

Still improving my front end development but could do with a bit of help. I only posted my front end (view) code because that is where work needs to be done.

Can anyone guide me with with the javascript/Jquery

<fieldset style="width:1200px;">
    <legend>StoreQuestions</legend>
    @Html.HiddenFor(model => model.storeId)
    <div class="editor-label">
        <h3>What condition was your Item in when you received it? (1 - Very Poor, 2 - Standard, 3 - Good , 4 - Excellent)</h3>
    </div>

 <input type="submit" value="Create" class="button">

[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Create(StoreQuestions storequestions)
{
        if (ModelState.IsValid)
        {
            db.StoreQuestions.Add(storequestions);
            db.SaveChanges();
            return RedirectToAction("Details", "Questions", new { id = storequestions.QuestionsId });
        }

        return View(storequestions);
}
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
cazlouise
  • 77
  • 1
  • 3
  • 11

1 Answers1

0

Never tested the code but:

<fieldset style="width:1200px;">
    <legend>StoreQuestions</legend>
    @Html.HiddenFor(model => model.storeId)
    <div class="editor-label" style='background-color:@(Model.id == theIdOfTheQuestion ? "blue" : "")'>
        <h3>What condition was your Item in when you received it? (1 - Very Poor, 2 - Standard, 3 - Good , 4 - Excellent)</h3>
    </div>
 <input type="submit" value="Create" class="button">

  [HttpPost]
    [ValidateAntiForgeryToken]
    public ActionResult Create(StoreQuestions storequestions)
    {
        if (ModelState.IsValid)
        {
            db.StoreQuestions.Add(storequestions);
            db.SaveChanges();
            return RedirectToAction("Details", "Questions", new { id = storequestions.QuestionsId });
        }

        return View(storequestions);
    }

You may wrap <div class="editor-label".. with @foreach to generate the questions and from it you get the theIdOfTheQuestion

Dabbas
  • 3,112
  • 7
  • 42
  • 75
  • i know what is it but do not know how to deal with it yet as i am still improving front end developement, however what you suggesting is to set all the editor-label with a background of blue, but what i want is based is the background to change based on the client who completed the questionnaire – cazlouise Nov 10 '16 at 11:30
  • @cazlouise I don't have the complete code, you need to provide more info, you can do the coloring condition using backend language and ajax requests. – Dabbas Nov 10 '16 at 11:32