set value of singleline and save the form


Badge +3

I would like to use a button to set the value of a single line text box (txtCurrentStatus) and then save the form. I have looked at some other questions on the community site but nothing seems to be working for me. I have set the client ID in the text box properties (idCurrStatus) and verified my function is being called with an alert function before and after my line to set the textbox value but the value never changes.

in form settings custom javascript I have:

function SetStatus () { 
   NWF$('#' + idCurrStatus).val("Approved"); 
}

button client click I have:

SetStatus()

(cause validation is no)

single line txtCurrStatus:

client ID is yes

value is idCurrStatus

After the form refreshes the value hasn't changed and the form hasn't saved. I have read two other post that are similar and neither seem to be working for me.


7 replies

Userlevel 4
Badge +12

Hey John,

you should be able to do this without JavaScript.

Open the settings of your button and go to the Advanced section.

There, set Connected to to your single line column.

Set Value returned to the value, you want to save once the button is hit.

202814_pastedImage_4.png

Hope this helps.

Kind regards

Enrico

Badge +3

Thank you for the repy Enrico!

I have tried that and it just doesn't change the value after the button is pressed.

connectedTo example

The button action is set to Save and Submit.

Badge +3

I created a new list and it worked exactly as you said. I am not sure what my existing list has in it that is causing the problem but I will work my way through it. Thank you Enrico!

Badge +3

I think I have found the issue and I would say it's a bug. If you move the field that you've connected the button or buttons to then it breaks that connection. If you move the field or textbox back to it's original position then the connection to works again.

Userlevel 4
Badge +12

Oh wow, that inded sounds like a bug. That functionality in general should be independent of the button's position.

Userlevel 7
Badge +17

That's very strange indeed. Please email support that occurrence so they can track that possible issue. 

Thank you so much for sharing your experience though and the way to avoid it. It will be very helpful to others!

Badge +3

Thanks Andrew. I have opened a ticket with support.

I also have made a new discovery that makes this less of a problem. It's not just moving the connected field, it's moving it below the button you are connected to. I have tested this issue on multiple lists and narrowed it down to only break if I move the single line below any of the connected buttons.

Reply