WordPress.org

Ready to get started?Download WordPress

Forums

User Submitted Posts
[resolved] show error message or success message to user (5 posts)

  1. WordPress.Net.In
    Member
    Posted 1 year ago #

    Hello

    I am using this plugin on a page where a lot of content and user has to scroll down to fill the form. But when user fill the form and either error message or success message is displayed the browser doesn't focus user to that place, which is actually just above the form, and user can't make sure if his submission is success or has any error.

    I want to show the message to user, i try get focus using javascript but the page is reload and i am not able to focus on message.

    Is there any help.

    http://wordpress.org/extend/plugins/user-submitted-posts/

  2. Jeff Starr
    Member
    Plugin Author

    Posted 1 year ago #

    Hi, the plugin passes a GET parameter on success or error that may be used to customize your theme however you like, for example:

    <?php if($_GET['submission-error'] == '1') { ?>
    	<div id="usp-error-message"><?php echo $usp_options['error-message']; ?></div>
    <?php } ?>
    <?php if($_GET['success'] == '1') { ?>
    	<div id="usp-success-message"><?php echo $usp_options['success-message']; ?></div>
    <?php } ?>
  3. WordPress.Net.In
    Member
    Posted 1 year ago #

    Thanks for quick reply. I try but not get success

    I use this javascript code, please check if I am wrong anywhere

    <script language="JavaScript">
      function setFocus() {
      document.getElementById('text').focus();
    
      }
    
    </script>

    And this code on submit button

    <input name="user-submitted-post" type="submit" onClick="setFocus()" value="<?php _e('Submit Post'); ?>">

    And the last code for focus on text box

    <input name="user-submitted-title" id="text" onFocus="setFocus()" type="text" value="" placeholder="<?php _e('Post Title'); ?>">

    Thanks

  4. Jeff Starr
    Member
    Plugin Author

    Posted 1 year ago #

    Not sure about the JavaScript, but the PHP in my previous reply works like a charm.

  5. MarketRaisen2
    Member
    Posted 7 months ago #

    Any idea how to remove these completely?

    Or better still keep them without hiding the form?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic