Fire required field validation inside custom app

I have created a Custom app for new ticket Page. In the app there are few text fields. I need to make these fields required to create a ticket.
I have checked the possibility to do below methods. But couldn’t found any document on it.

  1. stop submitting form until user fill required fields in custom app.
  2. disable submit button until required fields fill.
    Pls provide me any possible way to do this.

Hi @Nayana_Priyankara,
Good Day!
Kindly go through the below document for more reference

https://developers.freshservice.com/docs/events-methods/

Hope it helps

Thanks

I have tried itemChanged but it does not fire when I click submit. what is the correct one event for this.
I just used the same code in the doc.

      var propertyChangeCallback = function (event)
      // code to be executed when the type of the ticket is changed.
      {
          var event_data = event.helper.getData();
          console.log(event.type + " changed from " + event_data.old + " to " +  event_data.new);
      };

what is the event you used?

possible share with us the full script?

I’m calling inside userEffect like below.

    useEffect(() => {
      	// props.client.interface.trigger ("disableElement", {id: "status"})
      	// props.client.interface.trigger ("disableElement", {id: "subject"})
      	// props.client.interface.trigger ("disableElement", {id: "requester"})
        var propertyChangeCallback = function (event)
        // code to be executed when the type of the ticket is changed.
        {
            var event_data = event.helper.getData();
            console.log(event.type + " changed from " + event_data.old + " to " +  event_data.new);
        };
        props.client.events.on("ticket.itemChanged", propertyChangeCallback);
    })

But when I hit submit it never trigger the callback event.

Can you try changing both useEffect hooks to useLayoutEffect and see if it works?

it is still same. it never trigger the callback when click on submit button.

@Nayana_Priyankara I assume that you have added some fields via your App and you want to make that fields mandatory.

I will suggest to simply use $(“#ticket_form”).submit(function() { event to validate fields, before submitting the form or else you can use Jquery form validation library as well.

1 Like

Is it ok If I use jquery inside react app.

I thought you have created a APP using jquery and HTML. But you can try with jquery or we can validate via react as well.

It would be very helpful if you can explain how to do it using react.

Hi @Nayana_Priyankara

I sent you a chat message with a link to schedule office hours.

Let’s jump on a call and discuss the problem further in specific.

cc: @Santhosh

We joined during office hours to discuss this further.

Business Usecase — When users create a new ticket in Freshservice, we want the users to be able to search for an ID and enter the ID in a specific field. Without this mandatory field, the portal should not create a ticket.

Problem — There is no intercepting event on the New Ticket page in Freshservice. While the app can solve the “search” part of the use case, it cannot prevent users from creating tickets without mandatory fields entered.

We reported this lack of feature as a feature request to the product team.

We alternatively looked at two options:

  1. Build a background app that populates the list with IDs needed for the user and associates it with a custom ticket field created with the manage ticket fields module in Freshservice.
  2. Build a sidebar app that can be opened on a user click (the ideal experience is open by default, this functionality is unavailable) and associate it with a custom ticket field created with the manage ticket fields module in Freshservice.
1 Like

This topic was automatically closed 6 days after the last reply. New replies are no longer allowed.