locked
Dynamically Update a text field based on check box in checked state RRS feed

  • Question

  • Hi,

    I am creating a InfoPath form for SharePoint. I have a text field and a checkbox and I would like to dynamically update the text field if the check box is checked.

    I have set the default value of the text field to no and I would like it to dynamically change to yes when the checkbox is checked.

    Can anyone advise how to do this please?

    Kind Regards,

    Joel

    Friday, November 8, 2013 5:04 AM

Answers

  • Hi Joel,

    Set Rules for text box field

    Condition : When Check box field = True

    Action: Set field value: Field [Text Box] and Value =  Yes

    Hence when check box is checked - Text field will be Yes else it will show default value [No]..


    V Jean

    • Proposed as answer by Sairams Friday, November 8, 2013 5:39 AM
    • Marked as answer by Hemendra Agrawal Monday, November 11, 2013 5:18 AM
    Friday, November 8, 2013 5:38 AM

All replies

  • Hi,

    You can achieve this by using jQuery. Since you are using infopath forms you need to write this jQuery in your masterpage. 

    $('input[id*="chkBox"]').change(function(){
    
    $('input[id*="txtBox"]').val("Yes");
    
    });

    Regards,

    Regards,


    Sairam Avacorp Technologies

    Friday, November 8, 2013 5:12 AM
  • Hi Joel,

    Set Rules for text box field

    Condition : When Check box field = True

    Action: Set field value: Field [Text Box] and Value =  Yes

    Hence when check box is checked - Text field will be Yes else it will show default value [No]..


    V Jean

    • Proposed as answer by Sairams Friday, November 8, 2013 5:39 AM
    • Marked as answer by Hemendra Agrawal Monday, November 11, 2013 5:18 AM
    Friday, November 8, 2013 5:38 AM
  • Hi V Jean,

    Thanks for your reply. I thought that's what would work as well but it doesn't seem to update the checkbox at all when I check it. Which field should the Rule be placed on? I did it on the Text Box field.

    Thanks,

    Joel

    Sunday, November 10, 2013 11:09 PM
  • I have noticed that it almost is doing what I want it too. It seems that if the checkbox is unchecked and you type anything in the text box and then check the text box it changes the text in the text box to yes as I wanted. However, I don't want the user to have to type anything in that text box for it to work, only check the check box.

    Thanks,

    Joel

    Sunday, November 10, 2013 11:26 PM
  • I have figured it out, I used a dropdown list and that worked.
    Monday, November 11, 2013 2:16 AM
  • I hope its fixed now.. for check box - make it read only field .

    V Jean

    Monday, November 11, 2013 5:20 AM