duplicate news items and lost data in submit step 2

Register an Account
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 04-30-2009, 08:13 AM
Casual Pligger
Pligg Version: 1.0.4
 
Join Date: Apr 2007
Posts: 55
Ok so here are my steps to reproduce this. i am using plig 1.0RC4 with template wistie. tried in FF3 and IE7
  • submit a new news item
  • in step 2, dont enter a category
  • click preview and submit
  • an error page is displayed saying category is missing and a back button is also displayed
  • click back button to edit news item and add category

EXPECTED RESULT: you are taken back to your news item with all information there that you can edit and amend so that you can submit it.

ACTUAL RESULT: the back button reposts the submit step 1, so you are taken back to submit step 2 which does not show any information that you have previously entered. In the DB, it has now created 2 news items with status discard, neither of which have details such as title, tags, description etc that you have previously entered in.

some possible solutions:
  • add javascript field verification before posting step 2 information
  • save step 2 information in the db even if it is incomplete, then have the back button take you to the edit page for the news item so user can amend information before submitting


has anyone else experienced this
Reply With Quote
  #2 (permalink)  
Old 04-30-2009, 01:20 PM
New Pligger
Pligg Version: 1.0.0
 
Join Date: Apr 2009
Posts: 13
I get the same thing also.
Reply With Quote
  #3 (permalink)  
Old 05-05-2009, 04:15 PM
Casual Pligger
Pligg Version: 1.0.4
 
Join Date: Apr 2007
Posts: 55
well i managed to 'hack' a quick solution as this was driving me and others nuts... here is what i did

* copied the javascript from JavaScript Form Validation : quick and easy! to templates/wistie/js folder
* added the following just before the </head> tag in pligg.tpl
Code:
  {if $pagename eq "submit"}
    <script language="JavaScript" src="{$my_pligg_base}/templates/{$the_template}/js/gen_validatorv31.js" type="text/javascript"></script> {* ALEXADD *}
  {/if}
* added the following code right after </form> in submit_step_2.tpl

Code:
<SCRIPT language="JavaScript">
  var frmvalidator  = new Validator("thisform");
  frmvalidator.addValidation("title","req","Please enter a Title");
  frmvalidator.addValidation("title","minlength=10","Please enter a Title of at least 10 characters");

  frmvalidator.addValidation("category","dontselect=''","Please select a Category");

  frmvalidator.addValidation("bodytext","req","Please enter a Description");
  frmvalidator.addValidation("bodytext","minlength=10","Please enter a Description of at least 10 characters");
</SCRIPT>

obviously this is less than perfect, as you can set the minlength in pligg config and it will not be represented here, it will also not check custom fields automatically, you will need to add extra validation lines to the javascript above like frmvalidator.addValidation("mycustomfield","check for x","error message")

the best solution would be to have submit.php output this javascript based on what fields are set to be visible and what the minlength values are set to, or as i suggested initially to save the incomplete information to the database and then allow the user to go back and edit that information... but that is a more indepth solution...
Reply With Quote
  #4 (permalink)  
Old 05-05-2009, 05:32 PM
Yankidank's Avatar
Pligg Founder/Coder/Designer
Pligg Version: SVN
Pligg Template: Wistie
 
Join Date: Dec 2005
Location: Ocala, FL
Posts: 4,934
Send a message via AIM to Yankidank
Sorry to say this, but we already posted a solution to this problem couple weeks ago in the SVN version of Pligg. It now saves your story status and loads the data when you hit the modify button.
Also your demonstration uses javascript, but you didn't wrap it in {literal} and {/literal} tags. You might have put it between those tags unwittingly, but you always need to do that when adding javascript to a .tpl file.

The Twitter Module for Pligg CMS!
Register, Login, and Submit Stories with Twitter. An absolute MUST HAVE for all Pligg sites!
Reply With Quote
Reply

Tags
back, duplicate content, submit

Thread Tools
Display Modes




Pligg Modules and Pligg Templates from Pligg Pro Find support on the Pligg CMS Forum - 24 hours a day! Make a donation to support Pligg CMS development