Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8174581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T22:29:49+00:00 2026-06-06T22:29:49+00:00

I have a foreach for editing some items. Each item has a Save button.

  • 0

I have a foreach for editing some items.
Each item has a “Save” button. I want to show a message below the button.
How can i show this message inside the click event?
This is the html:

        <div id="divhorarios" data-bind="foreach: horarios">
    <div>
    <label>Fecha Ini: </label><input data-bind="value: FechaIni, datepicker: FechaIni, datepickerOptions: {dateFormat: 'dd/mm/yy'}" />
    <label>Fecha Fin: </label><input data-bind="value: FechaFin, datepicker: FechaFin, datepickerOptions: {dateFormat: 'dd/mm/yy'}" />
     <label>Nombre:</label> <input data-bind="value: Nombre"/>
    <br />
<button data-bind='click: $root.saveHorario'>Guardar</button>
    <br />
    <span data-bind="visible: showGuardado" style=" color: Green;">El horario ha sido guardado</span>
    </div>
    </div>

In the javascript code for the model i set the showGuardado=true but the message is not showing:

var HorariosModel = function (horarios) {
    var self = this;


    self.horarios = ko.observableArray(horarios);


    self.guardarHorario = function (horario) {
        $.post('/admin/horariosjsonguardar/' + idModelo, horario, function (returnedData) {
            horario.showGuardado = true;
        });
    };
};
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T22:29:51+00:00Added an answer on June 6, 2026 at 10:29 pm

    you haven’t got all the code there, but most likely you need to change it to :-

    self.horarios = ko.observableArray([]);
    ko.mapping.fromJS(horarios, {}, self.horarios);
    

    which will turn all the things passed in into observables.

    however, given the click handler, you actually probablly want something which handles the click on each of the array items, here is a fiddle showing the code in action :-

    http://jsfiddle.net/keith_nicholas/UqFP2/

    this way each button is independent and each has its own wee green message.

    NOTE: I changed the datepicker to a simple input and got rid of the post just for the example…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have two foreach loop to display some data, but i want to use
I want to display for each maker an AlertDialog that has some description, for
I have a foreach which imports data to our CMS. Now I want to
I have a foreach loop in jQuery going through each 'div.panel', I need to
So i have a foreach and i want to insert a bit of html
i want to have a foreach loop where the initial array is changed inside
I'm working on a project where I have some hierarchical data that I want
I want to generate some data for editing, filtered by the choice a user
I have a SQLite DB containing tasks. Each task has a date, and there
I have an edit page I want to use to allow editing of user

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.