Planet PDF Forum Planet PDF Forum
  New Posts New Posts RSS Feed - resetform after send
  FAQ FAQ  Forum Search   Register Register  Login Login

Hi, welcome to the Foxit Planet PDF Forum. If you have PDF or Adobe Acrobat questions then the right place to ask them is here, in this forum.

resetform after send

 Post Reply Post Reply
Author
ljsmith View Drop Down
New Member
New Member
Avatar

Joined: 18 Nov 2011
Location: Canada
Points: 3
Post Options Post Options   Quote ljsmith Quote  Post ReplyReply Direct Link To This Post Topic: resetform after send
    Posted: 18 Nov 2011 at 5:51pm
I'm trying to figure out a way to reset a form after an email is sent, without making the user manually click on the clear/reset button.
 
The form is extended, but we don't want the users to save the data locally. Yes, I realize the sent folder will have a copy, but the worry is having data persist causing input errors when the user reuses the form and doesn't clear all the data out before reusing.
 
I've tried creating two functions that basically check for a hidden field value which is blank for sending and once sent, it reads "Sent" (also may read "Error" if it hasn't passed validation....)
 
So basically I have one function to handle the send and a second to handle the reset. I did this because combining the code was clearing the form before the send. I split it hoping for a different reaction, since basically it would need to finish one function before beginning the next, but I'm getting the same result.
 
orignal send button code looks something like this:
 
function sendForm()
    var pH = this.getField("fieldName4").value
 
    Mandatory("fieldName1","fieldName2","fieldName2","fieldName3");
 
   if(pH == "") {    
     var esubject = "Test Send";
     var mBoxTo = email@domain.com;
     this.mailDoc(true, mBoxTo, esubject);
     }
   this.resetform()    
}
 
So, am I trying to do the impossible or does anyone have suggestions on how to get around this conundrum?
Confused
--
L. Smith
laura@ljsmith.ca
Common sense isn't.
Back to Top
gkaiseril View Drop Down
Senior Member
Senior Member


Joined: 15 Jul 2011
Location: USA
Points: 4111
Post Options Post Options   Quote gkaiseril Quote  Post ReplyReply Direct Link To This Post Posted: 21 Nov 2011 at 2:55pm
You need to place the "this.resetform()" within the block of code for the "if" statement.
 
I am not familiar with the "Mandatory" function. Can you explain what it does.
 
I would have written a function that return a logical true of false value and use the statement that calls that function to control the action of the 'if' statement.
 
 
Back to Top
ljsmith View Drop Down
New Member
New Member
Avatar

Joined: 18 Nov 2011
Location: Canada
Points: 3
Post Options Post Options   Quote ljsmith Quote  Post ReplyReply Direct Link To This Post Posted: 21 Nov 2011 at 3:01pm
The Mandatory function goes through the form and looks for checkboxes, radio buttons, text fields and combo/listboxes that are marked as required, but are empty or not selected (in the case of checkboxes and radio buttons, it would look for a series of either one with the same name, with no selection).
 
The pH value is what holds the check. If everything passes the mandatory field check, it will be empty. Otherwise, it holds a value of "Error". It's a visible but won't print field, I've set in white text. When we're testing, to make sure we've got everything working as necessary, we change the text colour to black so it's visible to us and we can verify the results. Otherwise, set in white text, it doesn't print out.
 
The problem I've been encountering is if I put the this.resetform() earlier in the code - it's wiping the fields before it's sent, and we want the data sent but don't want the form retained with data in it locally.
 
 
--
L. Smith
laura@ljsmith.ca
Common sense isn't.
Back to Top
aandi View Drop Down
Senior Member
Senior Member


Joined: 07 Jul 2011
Points: 18358
Post Options Post Options   Quote aandi Quote  Post ReplyReply Direct Link To This Post Posted: 21 Nov 2011 at 3:43pm
But the code as written calls resetForm even if the tests in Mandatory() fail...
Back to Top
ljsmith View Drop Down
New Member
New Member
Avatar

Joined: 18 Nov 2011
Location: Canada
Points: 3
Post Options Post Options   Quote ljsmith Quote  Post ReplyReply Direct Link To This Post Posted: 21 Nov 2011 at 4:22pm
It was one variant of the code, trying different placements, trying to get the form to blank after send.
 
I have gotten it to work, moving it to before the preceding "}" and it works.
 
There must have been a secondary trigger that was blanking the form before send that I'd cleared out in the mock code when I posted it here.
 
Been too long away from JS, and buried in VBA. While the logic while similar, definitely isn't the same. Wink
--
L. Smith
laura@ljsmith.ca
Common sense isn't.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.10
Copyright ©2001-2017 Web Wiz Ltd.

This page was generated in 0.035 seconds.