Newbie: changing some attributes before saving
Newbie: changing some attributes before saving
- Subject: Newbie: changing some attributes before saving
- From: Paul Marvine <email@hidden>
- Date: Tue, 26 Jun 2007 17:46:49 -0500
Hello,
This is a basic concept that I can't seem to get my brain to understand.
I have an entity called "webView" with an attribute called "headline".
When a user views a record and clicks a button (linked to an action
"doUpdates") I want to change "headline" and other attributes and
then save the record.
I've tried lines like...
webView.takeValueForKey("Hey, you clicked on the button", "headline");
or
webViewDisplayGroup.selectedObject().takeValueForKey("Hey, you
clicked on the button", "headline");
and always seem to get a "can't resolve symbol" error on build.
What is the correct way to do this.
Below is a simplified version of the page. The page works fine except
for the line in question.
//
// AdjustPagePreview.java: Class file for WO Component
'AdjustPagePreview'
// Project ContentDB
//
// Created by paul on 6/27/07
//
import com.webobjects.foundation.*;
import com.webobjects.appserver.*;
import com.webobjects.eocontrol.*;
import com.webobjects.eoaccess.*;
public class AdjustPagePreview extends WOComponent {
public WebView webView;
public WODisplayGroup webViewDisplayGroup;
public DeletePagePreview(WOContext context) {
super(context);
}
public WebView webView() {
return webView;
}
public void setWebView(WebView newWebView){
webView = newWebView;
}
public EditPage2 doUpdates()
{
EditPage2 nextPage = (EditPage2)pageWithName("EditPage2");
// webViewDisplayGroup.selectedObject() has an attribute of
"headline"
// I want to change this data to something different
// something like the line below
webViewDisplayGroup.selectedObject().takeValueForKey("Hey, you
clicked on the button", "headline"); // line in question
//this obviously doesn't work. What is the correct way to change
some of the attributes
// before it is saved?
this.session().defaultEditingContext().saveChanges();
nextPage.webViewDisplayGroup.setSelectedObject
( webViewDisplayGroup.selectedObject() );
return nextPage;
}
}
_______________________________________________
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