WordPress.org

Support

Support » Plugins and Hacks » WP Page Widget » [Resolved] [Plugin: WP Page Widget] Problem with Text widget

[Resolved] [Plugin: WP Page Widget] Problem with Text widget

Viewing 14 replies - 1 through 14 (of 14 total)
  • Describing the problem better, when I add Text widget, for example, when trying to save the page, these widgets disappears.

    Hello lucasmartins!

    I checked the case add Text widget you said, and do not see problem.
    So can you make the double test to check this case. And then, if this bug is continue to occur, can you please provide the way to reproduce with your WordPress system information?

    Thanks!

    macjoost

    @macjoost

    Hi,

    Like the plugin a lot, but have the same problem as lucasmartins

    Spend some time on it and finally discovered that the plugin works fine in FF, but doesn’t work with Safari or Chrome on the Mac.

    Somehow when dragging a “simple” widget like the Text widget to the sidebar, in the resulting HTML the <form> tags are missing.

    When dragging a more complex widget like the Tags widget to the sidebar, all works fine.

    I’m completely puzzled by this. I did quite some testing, checking the loaded JS libraries etc. but I can’t find any solution.

    Just encountered the same problem. I solved it by making sure I had at least 1 widget selected by default (using the standard WordPress widgets screen). The plugin only worked if one widget already existed for it to replace.

    Hi all,

    Scoe’s solution did not work for me, so I investigated a little further.

    Found that Webkit browsers (Safari, Crome) don’t allow for nested form elements to be created using javascript. That is what the “add widget” drag-drop does.

    I’ve changed the plugin PHP (see below) so that it transforms the <form> elements into <div> elements. Next changed the plugin JavaScript to conform to that change.

    It works for me on Safari, Chrome, FireFox and IE.

    Please test some more 🙂

    Hope Metalscorpion or CodeAndMore are following…

    Edit wp-page-widgets.php
    1. add new function

    function pw_fix_widget_forms( $list = '' ) {
    	ob_start();
    	switch( $list ) {
    	case 'wp_list_widgets':
    		wp_list_widgets();
    		break;
    	default:
    		wp_list_widget_controls($list);
    		break;
    	}
    	$output = ob_get_clean();
    	ob_end_clean();
    	$output = str_replace ( array('<form action="" method="post">','</form>'), array('<div class="pw_postbox">','</div>'), $output );
    	echo $output;
    }

    2. Change line 245 to
    <?php pw_fix_widget_forms('wp_list_widgets'); ?>

    3. Change line 260 to
    <?php pw_fix_widget_forms('wp_inactive_widgets'); ?>

    4. Change line 283 to
    <?php pw_fix_widget_forms( $sidebar ); // Show the control forms for each of the widgets in this sidebar ?>

    Edit page-widgets.js
    Change line 191 to
    var sb = widget.closest('div.widgets-sortables').attr('id'), data = widget.find('.pw_postbox').find('input, textarea').serialize(), a;

    Ok, error in the pw_fix_widget_forms function. Improved version below:

    function pw_fix_widget_forms( $list = '' ) {
    	ob_start();
    	switch( $list ) {
    	case 'wp_list_widgets':
    		wp_list_widgets();
    		break;
    	default:
    		wp_list_widget_controls($list);
    		break;
    	}
    	$output = ob_get_contents();
    	ob_end_clean();
    	$output = str_replace ( array('<form action="" method="post">','</form>'), array('<div class="pw_postbox">','</div>'), $output );
    	echo $output;
    }

    I’ve just tried your proposition but it’s not working for me…
    I just don’t understand ! It was working very well few days ago and now it’s down !
    The only thing that is working is to deselect plugins I’ve put in widget WP area.

    Plugin Author CodeAndMore

    @codeandmore

    It works for us for Text Widget without these modifications.
    Please download latest 1.4 and try again.
    Best regards,
    Tien[ Signature moderated. ]

    Hi Tien,

    Thanks for the update.

    I’m afraid that the new version still does not work on/with:

    • Chrome browser (tested on both Windows and Mac OS X)
    • Safari browser (tested on Mac OS X)

    It does work in FireFox (tested on both Windows and Mac) and Internet Explorer.

    What I did:

    1. Open an existing Post to edit.
    2. Drag a new Text widget from the “Available Widgets” window
    3. Edit the new widget and click “save”

    I confirm macjoost`s words.

    Works with: Internet Explorer 8, Firefox 9.0.1
    Does NOT work with: Opera 11.61, Chrome 16
    Windows 7 x64

    This is strange, but at least now it is working on IE and FF. None of them is my favorite browser.

    Plugin Author CodeAndMore

    @codeandmore

    OK thanks for reporting we will check on these browsers and may fix.
    Best regards,
    Tien[ Signature moderated. ]

    Super!

    I can recommend my hacks above 😉

    ntsasng

    @ntsasng

    CodeAndMore support

    Dear macjoost
    Please download latest version and try again.
    Best regards,
    Sang – CodeAndMore.

    Hello Sang,

    Tested latest in Safari and Chrome on Mac OS X with WP 3.3.1 and it works!

    Nice fix. Thanks!

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘[Resolved] [Plugin: WP Page Widget] Problem with Text widget’ is closed to new replies.
Skip to toolbar