Forums

Forums / General Discussions / Set a value to hidded text field as a result of other two text fields

Set a value to hidded text field as a result of other two text fields

3 posts, 1 answered
  1. Krishna Hari
    Krishna Hari avatar
    65 posts
    Registered:
    05 Dec 2019
    08 Sep 2020
    Link to this post
    i have a grid add form which gets first and last name  and a grid which shows full name
    i have a hidden field asrt_speakerfullname_0 on the form and a function

    $(document).on("tpc:pre-submit", function (event, form, formData, sender) {
            tpc.page.asrt_speakerfullname_0.set_value(tpc.page.asrt_firstname.get_value()+" "+tpc.page.asrt_lastname.get_value());
    });

    when I try to read the value of asrt_speakerfullname_0 in the grid  the full name is coming as null. what am I doing wrong?

     
  2. Omar S
    Omar S avatar
    51 posts
    Registered:
    04 Jul 2019
    11 Sep 2020 in reply to Krishna Hari
    Link to this post
    hi Krishna

    You may need to register for a Q+A for this. If speakerfullname is a text field, then it's possible that it's readonly. I would suggest you reveal it on your page for testing purposes and see if you can use change its value by using the code that is inside your tpc:pre-submit. 
  3. Adam Benoit
    Adam Benoit avatar
    23 posts
    Registered:
    01 Mar 2017
    Answered
    21 Sep 2020
    Link to this post
    Hi Krishna,

    The event you are looking for that will allow the values to be changes is the "tpc:pre-validate" event. This is the first event to fire and is the only one that will allow the data in the fields to be changed before submission. All other events fire after the contents have been checked to see if they have changed, i.e, are "dirty".  Once that happens, nothing can be changed.

    Hopefully this information is helpful.
3 posts, 1 answered