Skip to content
This repository has been archived by the owner on Nov 28, 2018. It is now read-only.

Duplicates after submit #47

Closed
btotheenno opened this issue Aug 26, 2013 · 14 comments
Closed

Duplicates after submit #47

btotheenno opened this issue Aug 26, 2013 · 14 comments

Comments

@btotheenno
Copy link

after submit, every submission got saved twice in the database.
It's database only mode.

any suggestions?

@greyskymedia
Copy link

Are there multiple forms on the page?

@btotheenno
Copy link
Author

no, always one single form

@greyskymedia
Copy link

Would you be willing to paste your code?

Jamison Mergens
web designer/developer

greyskymedia.com

p. (916) 234-0040
tf. (866) 722-GREY
f. (916) 209-8679

chat.
skype. jamison.mergens

mail & physical.

5875 Pacific St #E2

Rocklin, Ca 95677

From: Benno Kramer [mailto:notifications@github.com]
Sent: Tuesday, August 27, 2013 5:12 AM
To: silentworks/formz
Cc: greyskymedia
Subject: Re: [formz] Duplicates after submit (#47)

no, always one single form


Reply to this email directly or view it on GitHub #47 (comment) . https://github.com/notifications/beacon/L02b2wz1aIyDqVUFQPt4eKOa-gAmjqMefLS4-C2yiF6A9IJgIx9Rb0BT2zFbG142.gif

@btotheenno
Copy link
Author

sure! which part of it ?

fieldWrapTpl or formTpl chunk?

@greyskymedia
Copy link

both if you've changed things

@btotheenno
Copy link
Author

fieldWrapTpl

<!-- default -->
<div class="[[+outer_class]]" id="[[+name]]_wrap">
<label for="[[+name]]" title="[[+name:replace=`_== `:ucwords]]">[[+label:default=`[[+name:replace=`_== `:ucwords]]`]][[+req:notempty=` *`]]</label>
[[+inner_html]]
[[+note:notempty=`<span class="[[+note_class:default=`note`]]"><em>[[+note]]</em></span>`]]
[[+error:notempty=`<span class="[[+error_class]]">[[+error]]</span>`]]
</div>
<!-- default -->

formTpl

[[!FormIt?
    &hooks=`[[+action]][[+hooks:notempty=`,[[+hooks]]`]]`
    &excludeFields=`submit[[+id]]`
    &submitVar=`submit[[+id]]`
    &formid=`[[+id]]` [[- "Form ID"]]
    &store=`1`
    &storeTime=`900`
    &successMessage=`<p id="form_success">[[+success_message]]</p>`
    &emailTo=`[[+email:default=``]]`
    [[+properties]]
    [[+validation:notempty=`&validate=`[[+validation]]``]]
    [[+validationText:notempty=`[[+validationText]]`]]
]]

[[!+fi.successMessage]]
[[!+fi.validation_error_message]]

<form class="form [[+identifier]]" action="" method="post">
    <fieldset>
        [[+fields]]
    </fieldset>

    <div class="actions">
        <input type="submit" name="submit[[+id]]" value="[[+action_button:default=`Submit`]]" class="btn primary" />
    </div>
</form>


<script>
$(document).ready(function(){
var success = $('#form_success');

if(success.length > 0)
{
success.stop().css({'text-align':'center','display':'block','line-height':'1.8'}).animate({
marginLeft: "auto",
    fontSize: "2em",
    borderWidth: "10px",
backgroundColor: "#b4e391",
padding: "10px"
  }, 1000 );

  $('html,body').animate({scrollTop: success.offset().top}, 1000);

  var $message = "[[+success_message]]";

  alert($message);

  var formBlock = $('.form input[type=text],.form input[type=checkbox],.form input[type=radio],.form textarea,.form select,.form input[type=submit]');

  $(formBlock).each(function(elem){

var $this = $(this);

$this.attr('disabled', 'disabled');

  });

}else
{

}


});
</script>

@greyskymedia
Copy link

Have you tried submitting it without your script? That's the only thing I could see to take a look at.

@btotheenno
Copy link
Author

yep, i tried it with and without the javascript and there are still duplicates

@silentworks
Copy link
Collaborator

Which version of Formz are you using?

@btotheenno
Copy link
Author

formz-1.0.0-rc3

modx revolution version is 2.2.6-pl

@btotheenno
Copy link
Author

any suggestions?!

got already headache because of it....

@silentworks
Copy link
Collaborator

I can't think of any reason this would happen. I can't duplicate this either.

@sutrah
Copy link

sutrah commented Feb 3, 2014

Morizk did you find a solution i have exactly the same problem.
I can give full access, if someon want to see... I'm on revo 2.2.10 ive tried formz rc1, rc2, rc3 and the problem is still there...
Any ideas ?

@btotheenno
Copy link
Author

Hi,
my mistake was that i had something like this:

[[*someTV:is=`12`:then=`[[!fomz]]`:else=``]]
.
.
.somewhere else in the code
.
[[*someTV:is=`44`:then=`[[!formz]]`:else=``]]

I did that because i needed two different forms for different states, but that didn't worked out like this.
So be careful with output modifiers ;)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants