Update Field automatically
Hi all,
i calculate the Software costs from a related items lists with javascript. For example
var total = 0;
var rows = fd.relatedItems(5).data('ctx').ListData.Row;
rows.forEach(function(item) {
total += parseFloat(item['Kosten.'])
});
fd.field('Kosten_x0020_Software').value(total);
If i add a new row in the related items list i must press save two times to update the field "Kosten". Is it possible to update the field automatically?
Best wishes
Tom
i calculate the Software costs from a related items lists with javascript. For example
var total = 0;
var rows = fd.relatedItems(5).data('ctx').ListData.Row;
rows.forEach(function(item) {
total += parseFloat(item['Kosten.'])
});
fd.field('Kosten_x0020_Software').value(total);
If i add a new row in the related items list i must press save two times to update the field "Kosten". Is it possible to update the field automatically?
Best wishes
Tom
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
Not sure I undertood what Save button you mean. Do you use the related items in the quick edit mode?
Hi Dmitry,
i have a calculated field named "costs total" where the costs from the field hardware, software, maintenance are sum up. If i press the save button the field "costs total" is not updated. I must open the form again and if i press save again, the field is updated.
What must i do?
Best wishes
Tom
i have a calculated field named "costs total" where the costs from the field hardware, software, maintenance are sum up. If i press the save button the field "costs total" is not updated. I must open the form again and if i press save again, the field is updated.
What must i do?
Best wishes
Tom
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
The code you use looks right, it should updata the total immidiately after adding/removing rows. Just replace this:
fd.field('Kosten_x0020_Software').value(total);
with
fd.field('Kosten_x0020_Software').control()._el().html(total);
If it does not help, I recommend you to purchase 100 support minutes and provide temporary access to your form.
fd.field('Kosten_x0020_Software').value(total);
with
fd.field('Kosten_x0020_Software').control()._el().html(total);
If it does not help, I recommend you to purchase 100 support minutes and provide temporary access to your form.
Hi Dmitry, many thanks, it works. But one question, is it possible to sum this five fields (Bold) to a field named total costs?
For example:
Three sum fields (Hardware, Software and Maintenance) filled by javascript.
var total = 0;
var rows = fd.relatedItems(5).data('ctx').ListData.Row;
rows.forEach(function(item) {
total += parseFloat(item['Kosten.'])
});
fd.field('Kosten_x0020_Software').control()._el().html(total);
and two calculated fields (Internal programming and User training) filled by a sharepoint formula
=[Number of days]*500
Best wishes
Tom
For example:
Three sum fields (Hardware, Software and Maintenance) filled by javascript.
var total = 0;
var rows = fd.relatedItems(5).data('ctx').ListData.Row;
rows.forEach(function(item) {
total += parseFloat(item['Kosten.'])
});
fd.field('Kosten_x0020_Software').control()._el().html(total);
and two calculated fields (Internal programming and User training) filled by a sharepoint formula
=[Number of days]*500
Best wishes
Tom
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
You can use the same forumula in JavaScript and calculate a field value dynamically. Or probably, you can get a calcualte value like other field values: fd.relatedItems(5).data('ctx').ListData.Row[0]["CalcField"]
-
- Information
-
Who is online
Users browsing this forum: No registered users and 5 guests