WordPress.org

Ready to get started?Download WordPress

Forums

WP Page Widget
[resolved] Problem with Text widget (15 posts)

  1. lucasmartins
    Member
    Posted 2 years ago #

    Hello, when I try to add the widget "Text" I can not save the page. Can anyone help me?

    http://wordpress.org/extend/plugins/wp-page-widget/

  2. lucasmartins
    Member
    Posted 2 years ago #

    Describing the problem better, when I add Text widget, for example, when trying to save the page, these widgets disappears.

  3. Metalscorpion
    Member
    Posted 2 years ago #

    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!

  4. macjoost
    Member
    Posted 2 years ago #

    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.

  5. Sam Scholfield
    Member
    Posted 2 years ago #

    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.

  6. macjoost
    Member
    Posted 2 years ago #

    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;

  7. macjoost
    Member
    Posted 2 years ago #

    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;
    }
  8. Podd63
    Member
    Posted 2 years ago #

    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.

  9. CodeAndMore
    Member
    Plugin Author

    Posted 2 years ago #

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

  10. macjoost
    Member
    Posted 2 years ago #

    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"
  11. Mladen Gradev
    Member
    Posted 2 years ago #

    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.

  12. CodeAndMore
    Member
    Plugin Author

    Posted 2 years ago #

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

  13. macjoost
    Member
    Posted 2 years ago #

    Super!

    I can recommend my hacks above ;-)

  14. ntsasng
    Member
    Posted 2 years ago #

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

  15. macjoost
    Member
    Posted 2 years ago #

    Hello Sang,

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

    Nice fix. Thanks!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic