Clear Choice Field on Edit Form
Posted: 06 Jun 2018
Good Morning,
I'm fairly sure this is a simple one and I'm just missing a small step, I have a number of edit forms with single choice fields (drop downs), these are not required fields but can be set by the user as additional information. However under certain circumstances I need these fields to be set to back to "null", I am happy to do this using JavaScript and am using the following code
On the form itself this clears the value from the field, however on save what actually happens is the choice is selected automatically to the first choice in the selection list. (please note that the default choice is set to "null")
If I edit the list item in datasheet view I can clear these fields, can you please explain how to do this using JavaScript?
The second part of this is that there may be circumstances where I wish the user to be able to manually set the field to blank, but I am aware a blank choice cannot be added as a selection, what would you suggest as a way around this? Could I hijack the field selections and add the blank choice in on load of the form for the user to pick from using JavaScript, if so how would I do this?
Thanks
I'm fairly sure this is a simple one and I'm just missing a small step, I have a number of edit forms with single choice fields (drop downs), these are not required fields but can be set by the user as additional information. However under certain circumstances I need these fields to be set to back to "null", I am happy to do this using JavaScript and am using the following code
Code: Select all
fd.field('Intruder_x0020_Signalling_x0020_').value('');
If I edit the list item in datasheet view I can clear these fields, can you please explain how to do this using JavaScript?
The second part of this is that there may be circumstances where I wish the user to be able to manually set the field to blank, but I am aware a blank choice cannot be added as a selection, what would you suggest as a way around this? Could I hijack the field selections and add the blank choice in on load of the form for the user to pick from using JavaScript, if so how would I do this?
Thanks