• 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: Javascript focus on text field in repetition
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Javascript focus on text field in repetition


  • Subject: Re: Javascript focus on text field in repetition
  • From: "John Huss" <email@hidden>
  • Date: Tue, 14 Feb 2006 15:04:00 -0600

I didn't know you could make the body dynamic.  Cool, it's working now.
 
Here's some snippets to show what I did:
 
// WOD File
Body1: WOBody {
    >}
 
Form1: WOForm {
    name = "form1";
}
 
StoreNumberTextField: WOTextField {
    ...
    name = dynamicTextFieldName;
}
 
Repetition1: WORepetition {
    item = listItem;
    list = myList;
    index = rowIndex;
}
 

// JAVA File
public String dynamicTextFieldName() {
    return "myField" + rowIndex;
}
 
// returns _javascript_ code to focus on the correct text field
public String focusOnField() {
    if (addingItem) {
        addingItem = false;
        return String.format("document.form1.myField%d.focus();", myList.count() - 1);  
    } else
    return "document.form1.firstField.focus();";
}
 
 
----- Original Message -----
From: "Art Isbell" <email@hidden>
To: "WebObjects Dev Apple" <email@hidden>
Sent: Tuesday, February 14, 2006 1:57 PM
Subject: Re: _javascript_ focus on text field in repetition

> On Feb 14, 2006, at 9:42 AM, John Huss wrote:
>
>> My form is a master-detail form.  I have a button to add a new 
>> detail item, which adds a new row to my table and repetition.  I 
>> want to set focus on the textfield in the new row that get 
>> generated after the form is submitted and the page reloads.
>>
>> I can't use the onclick event of the button because the focus 
>> disappears after the page reloads.  How do I execute the _javascript_ 
>> after everything has been re-generated?
>
> I always add an onLoad event to the BODY tag to set focus.  If 
> different text fields might need focus under different circumstances, 
> I make BODY dynamic and add an "onLoad" key set to a component method 
> that returns an appropriate onLoad _javascript_ statement.
>
> Aloha,
> Art
>
> _______________________________________________
> 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
>
 _______________________________________________
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: 
 >Javascript focus on text field in repetition (From: "John Huss" <email@hidden>)
 >Re: Javascript focus on text field in repetition (From: zac <email@hidden>)
 >Re: Javascript focus on text field in repetition (From: "John Huss" <email@hidden>)
 >Re: Javascript focus on text field in repetition (From: Art Isbell <email@hidden>)

  • Prev by Date: Re: Javascript focus on text field in repetition
  • Next by Date: RE: tomcat clustering
  • Previous by thread: Re: Javascript focus on text field in repetition
  • Next by thread: RE: tomcat clustering
  • Index(es):
    • Date
    • Thread