Skip to main content

Hi All,

I am very new to JS.

I want a series of buttons, when one of them is clicked, it will write a certain value to a text field hidden on my form.

I have given my single line text box a JS ID, called "TabRules".

On button1, I have set client click to "Tab1Function()"

Now I need help writing that function!

I tried this but no luck:

function Tab1Function () {

NWF$("Tab1").click();

document.getElementById("TabRules").value = "My value";

}

Hello Dave Georgopoulis​ you're close! Here's a few updates to your scripts that should get you working!

Custom JavaScript in Form Settings:

function Tab1Function () {

  NWF$('#' + TabRules).val("My value");

}

JavaScript within your custom button's Client Click property:

NWF$(document).ready(function(){

    Tab1Function();

});

A few Notes:

  • Since you're already calling the Tab1Function() within your button's client click property, this doesn't need to be a part of the function itself (removed this piece).
  • I also did a little clean-up inside your function and used a jQuery approach to assigning your new "my value."

Good luck!


Wow! Thank you so much Patrick!

I can't believe I was "close" but I appreciate the encouragement!

The writing to the field is working perfectly!

Now I just have to figure out why rules won't fire!

thanks again happy.png


No problem Dave Georgopoulis​ – happy to help!


How can we do the same to set a value on a SQL request control. which is rendered as Label.


Hi Patrick,

I am wanting to do the same action with replacing a value, but I want to take a people picker field and set it to nothing. Is there a way to do this that you know of?


Reply