How to Trigger a Widget Refresh in the WordPress Customizer - wordpress

I have a widget where dynamic input fields are being inserted by javascript. Also, these fields can be sorted, and moved around.
The combination of these two things causes the Customizer "change" trigger for the widget not to fire, and therefore there is no selective refresh for the preview page.
Is there a way I can tell wp.customize to "re-listen" to all the input fields for a change event after a sort? And also, is there a way to manually fire a selective refresh in wp.customize after I change the sorting order inside a widget?
Changing the sorting order does not cause any input fields to change.

Related

GTM - Only Click DataLayer elements are available whereas I need a Trigger on a Load Element

In GTM, I'm trying to trigger on page text that's visible after a form is submitted since it does not change to another URL or refresh the page i.e. #bxAddSuccessTitle. However, the summary of events in GTM only capture the Click elements from the DataLayer. I've tried DOM, Custom JS variables, Window Load/Page View triggers and nothing populates until I click on the page.
Is there a workaround where I can trigger on something that is visible in the page source, but not necessarily in the datalayer?
enter code hereConfirmation Page
enter code hereConfirmation Page Source Code
enter code hereGTM Summary of Events
Sounds like you need a visibility trigger, probably with the "observe DOM changes" option active.
This will fire when an element comes into the viewport either by scrolling, when it is unhidden via css or, with the "observe DOM changes", when the element is created/inserted dynamically after a user interaction.
A possible caveat is that the trigger will only fire when the element is visible to the user (unhiding or inserting below the fold will not activate the trigger).

jqGrid ASP.NET Parent Row Selection and Child Edit Issue

I am attempting to use jqGrid ASP.NET for the first time and I'm having an issue with properly using a parent and child grid on my form.
Scenario: On my form I have two grids, one a parent that displays product information, and a second child grid that is used for editing a collection of prices for the product in the parent row. When a user clicks the plus sign in a parent row, the OnDataRequesting event is handled and I load the child grid with that product's prices. When the user clicks a price in the child grid, I use ClientSideEvents RowSelect and the server side RowEditing event to perform inline editing.
All of this was fairly trivial to set up and works great. Where I'm having an issue is that I'd like the selected row in the parent grid to act like a context for the rest of the page, i.e. the rest of the page displays information related to the product selected (charts, graphs, etc). For this I set up an event handler for the OnRowSelecting event and then trap the RowKey from the event args. That works great. However... the unintended side effect of setting up that handler is that once a user selects a row in the child grid to edit, the OnRowSelecting event fires in the parent, the page posts back, and when the page reloads the child grid is closed and the attempted edit is thwarted.
What I would like to know is, is there any built in way to handle this sort of scenario either through the client side jqGrid library or the Trirand.Web library? Or will I need to write some custom script to either send the selected parent row asynchronously or possibly trap the expanded child grid and attempt to reopen it once the post back is complete? Thanks.
I thought I'd brush off the tumbleweeds here and inject the answer I finally received from Trirand's support. As of the time of this writing, you can't do this. If you handle the OnRowSelecting event, you cannot use an editable child grid as they built it to specifically fire the parent's OnRowSelecting event anytime you select a row in a child grid.

Asp.NET AJAX control update field on form

I have a form with several text fields, a couple of drop down lists, and a custom asp.net control.
The requirement I have is that when the values of certain fields ( some are in the main form, some are inside the control ) the user will be alerted that the settings will not take place unless they also restart the processing and will have the option to reset it. If they exercise this option by pressing on the restart button, we execute an additional restart() method call on the server side on top of everything else.
In order to create this alert system I need to know when these required fields have changed. For the fields in the main form/page I store the original values in hidden fields when the page gets created (possible because the page is static). Then when the submit button is pressed I check the current values against the original values stored. If any of them differ I will alert the user.
For the fields in the custom control, I created a boolean property that indicates whether changes in the fields of interest took place. This control is highly dynamic contains a variable number of lists, some of them with over 100 items that can be selected or deselected. So this boolean property is able to identify if the changes I am looking for took place.
The problem is I need to get the value of this property when the user clicks on Submit, otherwise it will not contain the right value. But at the same time I want to avoid a postback. I do not want the whole page to reload. I want to get that value asynchronously somehow.
Since the whole page is stateless the question is how do I accomplish this? How do I accomplish the call to the property? And after I make the call and I get the result where do I store it so it's accessible from javascript code on the client side.
You can try putting a timer control in your ajax panel. Then on a set interval, you will evaluate the boolean property in your code behind.
Alternatively you can check the hidden field "changed" event using JavaScript or jQuery
http://api.jquery.com/change/

Drupal forms with WYSIWYG and AHAH

I'm trying to have an AHAH-enabled form with WYSIWYG fields in Drupal 6.
Problem
On this custom form, the user can click a button to add new fieldsets and add fieldsets within those fieldsets (so there is a parent-child nesting situation within the form). The addition and removal of fieldsets is handled via AHAH (and the ahah_helper module). Each of the parent and child fieldsets contain two fields which are text areas replaced by a WYSIWYG editor (with the Wysiwyg module using NicEdit 0.9). The problem is that on any AHAH submit, changes to any of the WYSIWYG fields are ignored. It appears as though the changes to the scripted field are not populated back to the HTML fields before submit, so the original value gets posted.
What I've Tried
My first thought for a solution was when the user clicks any of the AHAH buttons, simply remove all of the WYSIWYG fields with their native functionality. The two approaches I've tried haven't worked.
I can't add a click handler to the AHAH buttons themselves. An AHAH submit can add more such buttons, so I'd need a client-side callback function to bind the function on any new buttons. But I can't do that because Drupal doesn't let me modify or add to the client-side callback.
I can't add a click handler to the form container and let the events bubble up because the submit buttons interrupt event bubbling.
I ran into this same problem. Installing the WYSIWYG CCK Integration module solved if for me.
http://drupal.org/project/wysiwygcck

Modifying the Postback URL to ht a page anchor

I have a page with several gridviews. For usability, I have put these gridviews into a series of jquery tabs. Tabs works by creating anchor links that go to containers with certain ids, so after clicking on a given tab, the url might change from
host.com/page.aspx
to
host.com/page.aspx#tab2
The issue is that if any elements inside the tabs cause a postback, like trying to sort or page the grid for example, upon loading, the selected tab is lost, and reverts back to the first tab in the list. So in that case I would have sorted the right grid, but I'd have to click the correct tab again to see it.
To fix the issue, I want to track what anchor I'm at as the postback occurs, so that I can change the url I'm loading to include it. The only way I can think to do it is a Redirect, which I really don't want to incur the cost of.
Is there some better way to specify which anchor to load on postback?
On the forms onsubmit event, modify the action attribute to include the relevant anchor (which you'll need to keep track of yourself)
If the page is posting back to itself then instead of making the post back to foo.aspx you need to make it postback to foo.aspx#anchor.
You could also do this via cookies if you must but anchors is much better. Cookies are more useful for things like customizing the Yahoo page to focus on a particular tab on each visit.

Resources