views:

60

answers:

3

I have jquery pop form to upload a file, after on submit (the page refresh and the pop close) i check something about the file and then if there's something wrong i need to pop up that form again (from the java code?), how could i do that ?

A: 

When "something is wrong" the server-side code (this applies to any language) should include within the HTML content Javascript that will trigger the "form" to be displayed again.

matt b
@matt: I guess you are trying to refer success and failure blocks in AJAX?
Sam Rudolph
What I am saying is that if you want the client to act on an error, you need to have the response from the server indicate the error. Whether or not the error is handled with a success/failure block in Javascript depends on if the form is being submitted via AJAX or a regular browser POST - the original question doesn't state this.
matt b
@matt: Exactly this I was trying to ask,very well said ,client side should always be indicated about success or failure
Sam Rudolph
A: 

You should use ( or must be using) ajax in jquery with a popup. When the user hits "submit", control goes to server side code. The code runs to upload the file. Whatever the result of upload (success/failure), that message is sent to the popup with ajax automatically. In case, there is problem in uploading the file then, along with the failure message, you can send in the div which contains your form.

I think rather than refreshing the page to close the popup, allow the user to close the popup with close button.

tecks
A: 

As I feel dizzy presently,can't write the code,but will try to break whole procedure in multiple steps:-

  1. On Trigger(by some event) a pop up form will open from submission,which will have a button which will be calling a OnClick Event,which will be containing an Ajax call for client server communication
  2. till the response don't close or fade out the Pop up box.
  3. from server expect two tags SUCCESS or ERROR a) On SUCCESS, remove form DIV and fade out/close the pop up with a success message b)On Error,display a refreshed form DIV


And so on

Sam Rudolph