• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: WOSubmitButton closing the browser window
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: WOSubmitButton closing the browser window


  • Subject: Re: WOSubmitButton closing the browser window
  • From: Miguel Angel Torres Avila <email@hidden>
  • Date: Thu, 5 Mar 2009 16:59:40 -0600

I think the problem is that when you use the onClick event of a submit button that code is executed by the browser before the submit of the form. I think that's the reason why it is not working.

This is a possible solution (I did not test it)

1. Create a String on your java class

public String myAction = "no";

2. Relate the String to the value binding of a WOHiddenField that you place inside your form and set a name:

tfMyAction : WOHiddenField {
  value = myAction;
  name = "myActionField";
}

3. Set a name for your form

Form1: WOForm {
.....
  name = "myForm";
...
}

4. Use a _javascript_ Function like this:

function saveAndClose() {
document.myForm.myActionField.value = "savedPage";
document.myForm.submit();
///// Close the window but after 1 second to allow the browser submit the form
setTimeout("window.close()",1000);
}


5. in Your java class

 public void takeValuesFromRequest(WORequest r, WOContext c){
  super.takeValuesFromRequest(r, c);
  if(accion.equals("savedPage")){
   savedPage();
  }
 }

6 In your savedPage  funtion set the myAction variable to "no".


7. Use a simple hiperlink (I am not sure that it could work with a submit button)

<a href="" Apple-style-span" style="-webkit-text-stroke-width: -1; ">saveAndClose();"> Close Window </a>

I think it could work.

Good look!




______________________________
Ing. Miguel Angel Torres Avila




 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >WOSubmitButton closing the browser window (From: David Ress <email@hidden>)
 >Re: WOSubmitButton closing the browser window (From: Miguel Angel Torres Avila <email@hidden>)
 >Re: WOSubmitButton closing the browser window (From: David Ress <email@hidden>)

  • Prev by Date: Re: display group madness...
  • Next by Date: Re: WOSubmitButton closing the browser window
  • Previous by thread: Re: WOSubmitButton closing the browser window
  • Next by thread: Re: WOSubmitButton closing the browser window
  • Index(es):
    • Date
    • Thread