Jump to content

Using JS to change cascading dropdown


Recommended Posts

I have found that if I manually click on a dropdown that is a parent to another cascading dropdown,  the cascading dropdown works.

But when I try to use javascript to change the value of that parent dropdown,  I find that it does not kick off the cascading activity of the cascading dropdown that is connect to it.  Strangely,  the value changes in the parent dropdown (so it works),  but it doesn't impact the cascading dropdown.

The js code I am using to change the parent dropdown value is:  document.getElementsByName("cbParamVirtual1")[0].value="2012";     which successfully updates the value, so I know the JS works.  But it doesn't impact the cascading dropdown. 

Is there an onchange event that is misfiring?  Any suggestions?

Link to comment
Share on other sites

  • 9 months later...

@BaySunshine Are you still active? I am trying to do something similar. I need to do a cascading feature without doing it through Caspio Wizard. 

What I need is when a Job is selected from a Dropdown, Order_Number is populated with the Job_Number of selected job.

I am guessing something like

document.getElementsById("Job")[0].selectedIndex.text;

document.getElementsById("Order_Number")[0].value = "Job_Number";

Thanks,

KPC

Link to comment
Share on other sites

  • 3 weeks later...

Hi @kpcollier,

You can use a Calculated Value field if this is for a Submission form and write a Select query to fetch the correct value.

For example, your select query can look like the following:

SELECT JOB_NUMBER FROM TABLE_NAME WHERE JOB=TARGET.[@FIELD:fieldname]

fieldname = exact field_name from the current datasource. Similarly include the exact field names for JOB_NUMBER, TABLE_NAME and JOB from the table you are pulling the values from.

I hope that helps.

Regards,

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...