I have a context menu to provide various choices. However, I also want to be able to use row double click as an alternate means of performing one of the choices on the context menu -- i.e., without actually having to use the context menu. But, my RPG code still expects to see a value in the menu response field. Now, I see the changeElementValue() API but will that work on the value of a bound field?
So, the question is, how can I use JavaScript to set the menu response field and submit it? Thanks.
Set Menu Response via JavaScript
-
- Experienced User
- Posts: 165
- Joined: Wed Dec 11, 2013 10:40 am
- First Name: Dave
- Last Name: Clark
- Company Name: WinWholesale, Inc.
- Phone: 937-294-5331
- Address 1: 31101 Kettering Blvd.
- City: Dayton
- State / Province: Outside Canada/USA
- Zip / Postal Code: 45439
- Country: United States
- Contact:
Re: Set Menu Response via JavaScript
The changeElementValue() API doesn't work directly with a menu widget, but there is a way to accomplish what you're trying to do.
First you could bind a value to the 'menu response' property. Then you could add a hidden textbox widget which will work w/changeElementValue() and bind it's value to the same field as the 'menu response'. You could then set the textbox widget's value with JavaScript changing the value for the context menu as well.
Does that make sense?
First you could bind a value to the 'menu response' property. Then you could add a hidden textbox widget which will work w/changeElementValue() and bind it's value to the same field as the 'menu response'. You could then set the textbox widget's value with JavaScript changing the value for the context menu as well.
Does that make sense?
-
- Experienced User
- Posts: 165
- Joined: Wed Dec 11, 2013 10:40 am
- First Name: Dave
- Last Name: Clark
- Company Name: WinWholesale, Inc.
- Phone: 937-294-5331
- Address 1: 31101 Kettering Blvd.
- City: Dayton
- State / Province: Outside Canada/USA
- Zip / Postal Code: 45439
- Country: United States
- Contact:
Re: Set Menu Response via JavaScript
I understand what you're suggesting and I just tried it -- but it didn't work.
I have a context menu called "mnuContext" which has its "menu response" property bound to "mnuOption" and I created a hidden output field called "outOption" and bound its "value" property to "mnuOption" as well. Then, I have the following code in the "onrowdblclick" property.
I put my RPG program in debug and the correct row is read as a changed row (that is what clicking the hidden link accomplishes) but the "mnuOption" field is blank.
Now, I do have an open issue (Issue #451) with a similar problem where two menu widgets are bound to the same "menu response" field (the first is a context menu for right-click on the grid row and the second is a pop-up menu for left-click on a gear image widget) and the second menu widget isn't setting the response field. Is that the same problem in this case?
I have a context menu called "mnuContext" which has its "menu response" property bound to "mnuOption" and I created a hidden output field called "outOption" and bound its "value" property to "mnuOption" as well. Then, I have the following code in the "onrowdblclick" property.
Code: Select all
changeElementValue("outOption", "Select");
pui.click("lnkSelect." + row);
Now, I do have an open issue (Issue #451) with a similar problem where two menu widgets are bound to the same "menu response" field (the first is a context menu for right-click on the grid row and the second is a pop-up menu for left-click on a gear image widget) and the second menu widget isn't setting the response field. Is that the same problem in this case?
-
- Experienced User
- Posts: 165
- Joined: Wed Dec 11, 2013 10:40 am
- First Name: Dave
- Last Name: Clark
- Company Name: WinWholesale, Inc.
- Phone: 937-294-5331
- Address 1: 31101 Kettering Blvd.
- City: Dayton
- State / Province: Outside Canada/USA
- Zip / Postal Code: 45439
- Country: United States
- Contact:
Re: Set Menu Response via JavaScript
Well, the problem appears to be different in this case. I tried changing the hidden output field called "outOption" by binding its "value" property to a completely new field called "mnuOption3" but when I run in through debug "mnuOption3" is blank. Now what?
- David
- Profound Logic Staff Member
- Posts: 690
- Joined: Fri Jan 04, 2008 12:11 pm
- First Name: David
- Last Name: Russo
- Company Name: Profound Logic Software
- Contact:
Re: Set Menu Response via JavaScript
The problem is that you are using a hidden output field, which is not input-capable.
Try a textbox...
Try a textbox...
-
- Experienced User
- Posts: 165
- Joined: Wed Dec 11, 2013 10:40 am
- First Name: Dave
- Last Name: Clark
- Company Name: WinWholesale, Inc.
- Phone: 937-294-5331
- Address 1: 31101 Kettering Blvd.
- City: Dayton
- State / Province: Outside Canada/USA
- Zip / Postal Code: 45439
- Country: United States
- Contact:
Re: Set Menu Response via JavaScript
OK, now I have the same problem as Issue #451. If I bind the hidden text box to the same "menu response" field as the context menu, then that field is blank when RPG sees it. If I bind the hidden text box to a new response field, then RPG receives the desired value just fine.
So, just for fun, I tried binding the hidden text box to the same "menu response" field as my pop-up second menu and that exhibits the same problem as with the context menu. I was hoping it was just a context menu issue and not an "all menus" issue. Now I have two reasons for needing a fix to Issue #451.
So, just for fun, I tried binding the hidden text box to the same "menu response" field as my pop-up second menu and that exhibits the same problem as with the context menu. I was hoping it was just a context menu issue and not an "all menus" issue. Now I have two reasons for needing a fix to Issue #451.
Who is online
Users browsing this forum: Ahrefs [Bot] and 9 guests