No announcement yet.

Javascript assistance

  • Filter
  • Time
  • Show
Clear All
new posts

  • Javascript assistance

    I have written some javascript to concatenate an input field and a Radio Button to populate a third field. I thought I had made it so that the third field holding the result would not appear until there was data in both the input field and the radio button, but this does not seem to be the case. What am I missing in my code:

    //format for inputted time
    var TimeFormat = "h:MM";
    // field names
    var str1Field = "TimeIn"
    var str2Field = "TimeInTT"
    // get field values
    var str1 = this.getField(str1Field).value;
    var str2 = this.getField(str2Field).value;
    // concat strings if there is data
    if(str1 != "" && str2 != ""){
    var res = (TimeFormat, str1) + " " + str2;
    event.value = res;

    Thank you!

  • #2
    Dear intrepid505,

    I apologize for the inconvenience.As to this situation you mentioned,please help to email us the PDF form file sample with those JS scripts that you mentioned included for us to do further investigation.
    Please help to email it to [email protected] (Attn:Lisa) and also indicate this thread link. Thank you.


    • #3
      Thank you, Lisa. I sent it.


      • #4
        I found the solution to this issue as well. It seems that radio buttons and check boxes do not provide blank values when left unchecked. Rather they provide a value of "off". The conditions in my script above assumed that when not checked the values for the radio buttons were blank. I updated the script to not calculate when the radio button value is "off" instead of blank:

        if(str1 != "" && str2 != "Off"){