0

Passing Dropdown Value to Another Page

Hi everyone,

I'm trying to pass the value selected in a dropdown on my Dashboard page to a dropdown on my Job Setup page.

Here's the setup:

  • Dashboard Page: Has a dropdown field called "Job" (it's a link to the Job Table but shows as a combo box on the page). The user selects a Job from this dropdown.
  • Job Setup Page: Also has a "Job" dropdown (same field type as above). This page is opened when the user clicks a button on the Dashboard page (using the on click action from a formula field).

I want the Job selected on the Dashboard page to automatically be selected in the dropdown on the Job Setup page when it opens.

I can't work out how to reference one variable from the other page. 

Any help would be greatly appreciated!

Thanks,

 

Shane

6 replies

null
    • Fred
    • 2 wk ago
    • Reported - view

    Is Job Setup Page a Ninox Page? Or a Dashboard?

    Can you post your code from the onclick?

    • szormpas
    • 11 days ago
    • Reported - view

    Hi there, could you share a screenshot of your Data Model or give us a quick overview of the relationship between these tables?

    • shane
    • 10 days ago
    • Reported - view

    Thanks Fred and Sotirios, 

     

    Both the pages are Ninox Pages. 

     

    The Dashboard is linked to the Jobs Table but the Job Setup page isn't linked to anything. I just have it as a way I can control what the user enters before saving anything. There are fields on it but they are all set to just "Per record in Memory". 

     

    I've recorded a screen cast here so hopefully it will make it make more sense, and not less!

    Screen cast: https://watch.screencastify.com/v/PpVGfsc06ilX4e5cPWTS

    Many thanks

      • Fred
      • 10 days ago
      • Reported - view

      You can try something like this in the onclick of the Method Statement button.

      let t := this;
      let otherPage := record('Job Setup',1);
      otherPage.('Choose Job to Edit' := number(t.Jobs));
      openPage('Job Setup', "Edit Job")
      

      Line 1, put the current record/page into a variable.

      Line 2, uses the record() command to get the record information of the Job Setup page. A page is special table that only has 1 record, so you can always reference the first record.

      Line 3, we then set the 'Choose Job to Edit' dynamic field in the Job Setup page to the job selected in the first dashboard. Since 'Choose Job to Edit' is a dynamic field, we only need the record number. Jobs is a reference field, so we have to convert it to a simple number.

      Line 4, we use the new openPage() command to open the Page you want and then take us to the tab you want.

    • shane
    • 9 days ago
    • Reported - view

    Thanks Fred, 

     

    That worked perfectly.

    (Had to make one small change - double quotes on Job Setup in the open page function openPage("Job Setup", "Edit Job").

     

    Thank you for your time. Very much appreciated!

      • Fred
      • 9 days ago
      • Reported - view

       You are welcome. When you get a moment please mark the post “answered”. Thanks,

Content aside

  • Status Answered
  • 9 days agoLast active
  • 6Replies
  • 57Views
  • 4 Following