hi again,

there is an additional similar question i would like to ask you:

how to to this - a class called Campaign - a class called CampaignContents
(for n:m relations) - and a class called Content

 Class EMEM.Campaign Extends EMEM.NLSObject [ ClassType = persistent,
ProcedureBlock ]
{
 Relationship Contents As EMEM.CampaignContents [ Cardinality = many,
Inverse = Campaigns ];
...
}

 Class EMEM.CampaignContents Extends (%Persistent, %Populate, %XML.Adaptor)
[ ClassType = persistent, ProcedureBlock ]
{

Relationship Campaigns As EMEM.Campaign [ Cardinality = one, Inverse =
Contents ];

Relationship Contents As EMEM.Content [ Cardinality = one, Inverse =
Campaigns ];

Index CampaignsIndex On Campaigns;

Index ContentsIndex On Contents;

}

 Class EMEM.Content Extends EMEM.NLSObject [ ClassType = persistent,
ProcedureBlock ]
{
 Relationship Campaigns As EMEM.CampaignContents [ Cardinality = many,
Inverse = Contents ];

...
}

and a form that should offer all Campaings in a select tag and save the
relation (n:m) and create a relation object to handle it
along with the content object:

 <!-- use CSP:OBJECT tag to create a reference to an instance of the
class -->
<csp:object name="objForm" classname="EMEM.Content"
OBJID=#(%request.Get("OBJID"))#>
...
 <form name="form" cspbind="objForm" enctype="multipart/form-data"
method="post" cspjs="All" onsubmit='return form_validate();'>
<table border='0'>
<tr>
<td><font color="#666666"><b><div align="right">Campaign
Name:</div></b></font></td>
<td>
<SELECT name="Campaign" cspbind="Campaigns.Campaigns" size="1">
<option value=""></option>
<CSP:WHILE CONDITION="CampaignList.Next()">
<option
value=#(CampaignList.Get("ID"))#>#(CampaignList.Get("NameDe"))#</option>
</CSP:WHILE>
</SELECT>
</tr>
<tr>
<td><b><div align="right">NameDe:</div></b></td>
<td><input type="text" name="NameDe" cspbind="NameDe" size="80"></td>
</tr>
 <tr>
<td><input type="button" name="btnClear" value="Clear"
onclick='form_new();'>
<input type="button" name="btnSave" value="Save" onclick='form_save();'>
<input type="button" name="btnSearch" value="Search"
onclick='form_search();'></td>
</tr>
</table>
</form>


it is not done automatically as i expected,
what to do ?

write a form_save method - and how ?

brg
werner


"Bill McCormick" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> This is too complex a structure for the basic binding. It can handle
> simple one-one pointer objects and CAN handle related ones as well where
>   relationship between the two has been clearly defined that is not the
> case here. You have a one to many relationship between the Content and
> Header class but your bind says Header.Name - this is not correct. The
> reference would look something like Header.GetAt(x).Name. You have not
> bound the Header object so we are not creating a new record regardless
> of whether you could provide the x and get access to an existing. A
> better approach is a form for modifying the Header where you make
> certain to provide a cspbind property on the Content "One" object. We
> can generate code to handle that. You could write your own logic for
> saving/retrieving data from this page and still implement this with CSP.
> We simply can't generate a binding for it.
>
>
> Dipl.-Ing. Werner Riegler wrote:
> > hi there again,
> >
> > can anybody tell me if it should work
> > to create and save referenced objects within the same form as the object
> > itself ?
> >
> > i use a standard wizard generated form - but it does not seam to work ?
> > (no error - but noting created)
> >
> >  Class EMEM.Content Extends EMEM.NLSObject [ ClassType = persistent,
> > ProcedureBlock ]
> > {
> > Relationship Body As EMEM.ContentBody [ Cardinality = one, Inverse =
> > Content ];
> > Relationship Campaigns As EMEM.CampaignContents [ Cardinality = many,
> > Inverse = Contents ];
> > Relationship Footer As EMEM.ContentFooter [ Cardinality = one, Inverse =
> > Content ];
> > Relationship Header As EMEM.ContentHeader [ Cardinality = one, Inverse =
> > Content ];
> > Relationship SubContent As EMEM.SubContent [ Cardinality = many, Inverse
=
> > Content ];
> > Query ContentList() As %SQLQuery(CONTAINID = 1)
> > {
> > SELECT %ID,NameDe FROM Content ORDER BY NameDe
> > }
> > Index BodyIndex On Body;
> > Index FooterIndex On Footer;
> > Index HeaderIndex On Header;
> > }
> >
> > just try to create/save Content and Header (Property Name for Header):
> >
> >  <!-- use CSP:OBJECT tag to create a reference to an instance of the
> > class -->
> > <csp:object name="objForm" classname="EMEM.Content"
> > OBJID=#(%request.Get("OBJID"))#>
> > <!-- use csp:search tag to create a javascript function to invoke a
search
> > page -->
> > <csp:search name="form_search" classname="EMEM.Content" where="NameDe"
> > options="popup,nopredicates" onselect="update">
> > <form name="form" cspbind="objForm" cspjs="All" onsubmit='return
> > form_validate();'>
> >  <center>
> > <table cellpadding="3">
> >  <tr>
> > <td><b><div align="right">NameDe:</div></b></td>
> > <td><input type="text" name="NameDe" cspbind="NameDe" size="80"></td>
> > </tr>
> > <tr>
> > <td><b><div align="right">DescriptionDe:</div></b></td>
> > <td><input type="text" name="DescriptionDe" cspbind="DescriptionDe"
> > size="80"></td>
> > </tr>
> > <tr>
> > <td><font color="#666666"><b><div align="right">Header
> > Name:</div></b></font></td>
> > <td><input type="text" name="HeaderName" cspbind="Header.Name" size="80"
> >
> >></td>
> >
> > </tr>
> >  </table>
> > </center>
> > </form>
> >
> >
> > or do I need to modify or create my own form_save method to achive this
?
> >
> > brg
> > werner
> >
> >



Reply via email to