Navigation

    APPDRAG Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular

    REMINDER

    Please be respectful of all AppDragers! Keep it really civil so that we can make the AppDrag community of builders as embracing, positive and inspiring as possible.

    SOLVED Cloud Backend trigger formula parameter

    General Discussion
    2
    4
    213
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C
      Constance Hua last edited by

      Hi there,
      there is a parameter type in the backend trigger called "formula (javascript)".
      There is NO documentation about it. How frustrating.

      So because the software vendor was not able to document their functionalities properly, I need your help to resolve this:

      One parameter is called "ID" and this ID is actually the id of the parent element of the current element (where I add this trigger).

      I tries to enter "this.parentElement.id" but I get the error: "Cannot read properties of undefined (reading 'id')"

      Can someone help please?
      Thank you
      Constance

      Joseph Benguira 1 Reply Last reply Reply Quote 0
      • Joseph Benguira
        Joseph Benguira @Constance Hua last edited by

        Hey @constance-hua,
        In that field you can pass ANY valid Javascript instruction

        here is an example to fetch the value of an input name EMAIL:
        $("input[name='EMAIL']").val()

        C 1 Reply Last reply Reply Quote 0
        • C
          Constance Hua @Joseph Benguira last edited by

          @joseph-benguira said in Cloud Backend trigger formula parameter:

          $("input[name='EMAIL']").val()

          Thanks a lot Joseph for the example, so not javascript but jQuery actually, I see.

          I tried with jQuery to get the parent element ID but it also did not work:
          $(this).parent().attr('id')

          Did you try on your side? Here is how to reproduce:

          • Create a button section, give it an ID (edit element -> identification)
          • Add a button in this section and create a cloud backend action
          • Before the function call, check the box "execute a javascript" and add a code to trigger a confirmation pop up for e.g. Put the parent ID in that pop up:
          //I tried this: 
          var id = this.parentElement.id
          //and this:
          var id = $(this).parent().attr('id')
          
          confirm(id)
          

          Let me know if you succeed and how!
          Thanks!
          Constance

          1 Reply Last reply Reply Quote 0
          • Joseph Benguira
            Joseph Benguira last edited by Joseph Benguira

            @constance-hua your logic seems too complex ... Instead please try this

            1. hide your original button
            2. create a new button that open your confirmation modal
            3. if accepted, generate a click to the real hidden button. Eg: $("#myHiddenButton").trigger('click')

            done 🙂

            1 Reply Last reply Reply Quote 0
            • First post
              Last post