Hello Daniele,

Thanks for your reply. The sub-component is actually a WOSwitchComponent that is dependent on the subclass of entity that is loaded in the page. This is the first subclass that I have made that requires an uploaded graphic associated with the metadata. The date uploaded was just a poorly thought out example of additional metadata in my form ;). If anyone is curious, the pattern is much like Chuck hints at in the last paragraph of this mailing list post: http:// lists.apple.com/archives/webobjects-dev/2004/Oct/msg00357.html

I was hoping that there was an easy entry point in a subcomponent to set values in the EO before the sub-component's values passed to the main component when it saved. If it is impossible, I'll just add the graphic to the main form as you have suggested so that every entity with that parent class gets an optional graphic element as well.

Thanks again,
David

On 9 Aug 2007, at 12:26 AM, Daniele Corti wrote:



2007/8/9, David Holt <[EMAIL PROTECTED]>:
I have a sub-component inside a form that contains a WOFileUpload.

<form>
Name
Address
<uploadcomponent>
WOFileUpload
Date of upload
</uploadcomponent>
Submit
</form>

Normally I set the values in the database using a method that
evaluates the bindings in the WOFileUpload when I submit the form. In
this case I can't do that because the submit button is in the parent
component. How can I programatically set attribute values in a sub-
form when the parent form is submitted?

David, I really don't see a good reason to split you data in two component: if you have one submit, the best choice would be to have the entire form inside the subcomponent. Another way would be to set the form as Multiple submit, and create two submit: one for the FileUpload, One for the other data to save.

I.E.

YourMainComponent Start
  <wo:WOForm>
  <wo:WOTextFileds value="$name" />
  <wo:WOText value="$address" />
  <wo:UpLoadComponent />
  <wo:WOSubmitButton action="$saveAllData" />
  </wo:WOForm>
YourMainComponent End

UpLoadComponent Start
  <wo:WOFileUpload /> //I don't remember the binding for this...
  <wo:WOSubmitButton action="$uploadFile" />
UpLoadComponent End

You can see I don't insert Date of Upload, because I've not understand what that was: if it is an input for the date is useless, because The date is the moment when the submit is press, if it is a String with the current date, you can display it after the submit of the subcomponent, in place of the WOFIleUpload
David
_______________________________________________
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/ildenae% 40gmail.com

This email sent to [EMAIL PROTECTED]



--
Daniele Corti
AIM: S0CR4TE5
Messenger: [EMAIL PROTECTED]

--
Computers are like air conditioners -- they stop working properly if you open
WINDOWS

--
What about the four lusers of the apocalypse? I nominate:
"advertising", "can't log in", "power switch" and "what backup?"
--Alistair Young

 _______________________________________________
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]

Reply via email to