[Seaside] Newbie question
James Foster
Smalltalk at JGFoster.net
Sat Aug 30 20:05:41 UTC 2008
Hi Adrian,
I haven't tried your code myself, but a brief visual scan suggests at
least one problem that I've identified below...
On Aug 30, 2008, at 9:32 PM, r00t uk wrote:
> Hello All
>
> I am slowly working my way through Squeak and Seaside using "An
> Introduction to Seaside" and the Seaside examples as my learning
> guides. I have come across an issue which I don't understand, and I
> am hoping someone could enlighten me as to what is going wrong. The
> two methods below are called by
> MLHeadDataModelView>>renderContentOn:, with
> MLHeadDataModelView>>renderCompanyTextInputOn: resulting in a
> MessageNotUnderstood: WARenderCanvas>>value: error.
>
> The instance methods are:
>
> MLHeadDataModelView>>renderCompanyTextInputOn: "This method
> generates the 'MessageNotUnderstood: WARenderCanvas>>value:' error"
> self
> renderLabel: 'Company Name: '
> input: [
> html textInput;
> value: self headDataModelView companyName;
> callback: [:value | self headDataModelView companyName:
> value]]
> output: self headDataModelView companyName
> on: html.
>
> MLHeadDataModelView>>renderEmployeeTextInputOn:
> self
> renderLabel: 'Employee Name: '
> input: [
> html textInput setFocus;
In Smalltalk the semantics of a cascade (indicated by the semi-colon)
means that the following #value: message is being sent to the receiver
of the last message. The last message is #setFocus, and the receiver
of the #setFocus was the object returned by the #textInput message.
Thus, #value: is being sent to a WATextInputTag (or similar object),
not to the WARenderCanvas (which is probably what you really wanted).
> value: self headDataModelView employeeName;
> callback: [:value | self headDataModelView employeeName:
> value]]
> output: self headDataModelView employeeName
> on: html.
>
> MLHeadDataModelView>>initialize
> initialize
> super initialize.
> self headDataModelView: MLHeadDataModel new.
>
> I don't get any error messages if I use the on:of: style, but not
> sure what exact difference or benefits are between the two.
The difference is that you don't have a #setFocus message.
> MLHeadDataModelView>>renderCompanyTextInputOn:
> renderCompanyTextInputOn: html
> self
> renderLabel: 'Company Name: '
> input: [
> html textInput on: #companyName of: self
> headDataModelView]
> output: self headDataModelView companyName
> on: html.
>
> MLHeadDataModelView>>renderEmployeeTextInputOn:
> renderEmployeeTextInputOn: html
> self
> renderLabel: 'Employee Name: '
> input: [
> html textInput on: #employeeName of: self
> headDataModelView]
> output: self headDataModelView employeeName
> on: html.
>
> Thanks in advance for any feedback.
>
> Regards
> Adrian
Hope that helps, and welcome to Seaside!
James Foster
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20080830/febc0a74/attachment-0001.htm
More information about the seaside
mailing list