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 {
>}
Body1: WOBody {
>}
Form1: WOForm {
name =
"form1";
}
StoreNumberTextField: WOTextField
{
...
name = dynamicTextFieldName;
}
...
name = dynamicTextFieldName;
}
Repetition1: WORepetition
{
item = listItem;
list = myList;
index = rowIndex;
}
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();";
}
return String.format("document.form1.myField%d.focus();", myList.count() - 1);
} else
return "document.form1.firstField.focus();";
}
----- Original Message -----
From: "Art Isbell" <[EMAIL PROTECTED]>
To: "WebObjects Dev Apple" <[email protected]>
Sent: Tuesday, February 14, 2006 1:57 PM
Subject: Re: _javascript_ focus on text field in
repetition
>
>> 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 protected])
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/webobjects-dev/jhuss%40icsusa.com
>
> This email sent to [EMAIL PROTECTED]
>
_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [email protected]
