Request Checkbox on submit
Good morning, don't know if somebody can help me on this.
i presently use something like this = $('#request_custom_fields_1260825969349').val(); to request value of a custom field on submit. I then can add the value in that text box into the description.
What method would i use for checkbox.
I am looking to see if on submit the checkbox is checked or not checked
-
Hi @...,
Thanks for reaching out!
You can use the ticket object to access the value of the checkbox, so something like this could work:
client
.get("ticket.customField:custom_field_1260825969349")
.then(data => console.log(data));This will return a string of ‘yes’ or ‘no’ depending on if the checkbox has been checked or not.
Here’s a link to the relevant docs:
Alternatively, you can also set the custom field to ‘required’ in your Zendesk instance UI. Here’s some information on how to do that:
I hope this helps! If you have any questions, feel free to reach out.
Tipene
-
I am programming this in the script.js file, this code will work in there?
see sample below of what i presently do
function checkitsupportrequiredfields() {
var strITTopicReq = $('#request_custom_fields_1260812850530').val();
var strITDescriptionReq = $('#request_custom_fields_1260812850510').val();
var strITDescriptionReqLength = $('#request_custom_fields_1260812850510').val().length;
if (strITTopicReq != "" && strITDescriptionReqLength > 3) {
$(':input[type="submit"]').prop('disabled', false);
$('#request_description').val(strITDescriptionReq);
} else {
$(':input[type="submit"]').prop('disabled', true);
$('#request_description').val(strITDescriptionReq);
}
} -
Hi @...,
Yes, there shouldn't be any problem using the method I mentioned above in your code. If you'd like to send me the relevant files though, I can double-check that for you. Just be sure to redact any sensitive information.
Thanks!
Tipene
Iniciar sesión para dejar un comentario.
3 Comentarios