NetTalk Central

Author Topic: How to put a calculated value in a form-field?  (Read 2960 times)

Nick

  • Full Member
  • ***
  • Posts: 118
    • View Profile
    • Email
How to put a calculated value in a form-field?
« on: December 18, 2013, 04:22:41 PM »
Hi,

I want to calculate a value by using a button and put the result into a field on a form.
I use the "send new value to server" and calculate the value there.
But how/where can I put that into a field on the the same form?

Thanks,
Nick

Rob Kolanko

  • Sr. Member
  • ****
  • Posts: 253
    • View Profile
Re: How to put a calculated value in a form-field?
« Reply #1 on: December 18, 2013, 05:25:04 PM »
- In the  "send new value to server" embed, place the result of your calculation into a session variable. e.g. p_web.SSV('Result', varResult)
- Add a Display field on the form where the text of the field is the session variable.  p_web.GSV('Result')
- In the template for the button that is calculating the result, on the "Client-Side" tab add the display field to the fields to be reset.

When the user pushes the button the result of the calculation will appear in the display field.

I hope this helps.

Rob 

Nick

  • Full Member
  • ***
  • Posts: 118
    • View Profile
    • Email
Re: How to put a calculated value in a form-field?
« Reply #2 on: December 19, 2013, 05:04:00 AM »
Hi Rob,

>>- In the  "send new value to server" embed, place the result of your calculation into a session variable. e.g. p_web.SSV('Result', varResult)
>>- Add a Display field on the form where th e text of the field is the session variable.  p_web.GSV('Result')
>>- In the template for the button that is calculating the result, on the "Client-Side" tab add the display field to the fields to be reset.

"where the text of the field is the session variable" I missed that part. Thanks!

But what to do if the field is a string (input) field? It has no place (as far as I see) to put this p_web.GSV() in?
(the field I use can be filled by the calculation but may be entered by hand too)

Nick

Nick

  • Full Member
  • ***
  • Posts: 118
    • View Profile
    • Email
Re: How to put a calculated value in a form-field?
« Reply #3 on: December 19, 2013, 06:08:52 AM »
Never mind, got it!

Thanks.
Nick