Andres Rormoser
|
| Posted: 11/07/2005, 11:42 AM |
|
I read several messages in the forums talking about Master and Detail 2 Forms problem and
the CCS solution to disable the form that you do not touch first.
But i really need i solution to update both forms when one is submitted. Anyone found a
solution?
Thanks, Andres Rormoser.
|
|
|
 |
peterr
Posts: 5971
|
| Posted: 11/07/2005, 12:01 PM |
|
This is not related to CCS. HTML standards and Web browsers simply don't allow submitting 2 forms with one button. Please let us know if you find a solution outside of CCS, or any other Web application that can do this.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
dragoon
Posts: 173
|
| Posted: 11/07/2005, 1:23 PM |
|
what about to put the 2 forms in different frames?
first, submit the form from the different frame where the submit button resides using onsubmit event and after this submit the other form.
I never tried this, but you give it a try ....
|
 |
 |
Andres Rormoser
|
| Posted: 11/09/2005, 12:40 PM |
|
Peterr:
Thanks for your pront response, I was reading Genexus Help File (another RAD
application)
(http://66.132.154.118/cgi-bin/adcret03.cgi/Getting%20Started%20with%20GeneXus%2080.PDF?9283710652,1,1051)
and this application with Master/Detail tables generates one form to submit both tables
(see page 42 on help file)
AR
"peterr" <peterr@forum.codecharge> wrote in message
news:6436fb29aabd17@news.codecharge.com...
This is not related to CCS. HTML standards and Web browsers simply don't allow
submitting 2 forms with one button. Please let us know if you find a solution
outside of CCS, or any other Web application that can do this.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
---------------------------------------
Sent from YesSoftware forum http://forums.codecharge.com/
|
|
|
 |
Vasiliy
Posts: 378
|
| Posted: 11/09/2005, 12:53 PM |
|
Are you talking about 2 tables or 2 forms?
_________________
Vasiliy |
 |
 |
peterr
Posts: 5971
|
| Posted: 11/09/2005, 1:13 PM |
|
Andres,
True, if you use one form then there should be no such limitations. You just cannot submit multiple forms together.
Also, .NET always submits the whole page as one form, so you have more flexibility there than with ASP.
Now I guess that with ASP you could also try using just one form instead of multiple ones. For example use just the Editable Grid form, but add a few additional fields at the top of that form that will act as your "Master" section. Then when the form is submitted you could process those additional fields via custom code.
Possibly we can automate this in the future.
Thanks for pointing the example.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
marcwolf
Posts: 361
|
| Posted: 11/09/2005, 4:49 PM |
|
Well there is a way but its technical and starts to move away from the traditional web environment.
Here are a couple of Idea's.
You CAN read the contents of both forms using Javascript.
So when you submit one, you also get Javascript to serialise the contents of the second form and put it into a hidden field on the first form.
That way on the server you have the contents of both forms.
Anothe idea is to look at Ajax or a server 'back-channel' concept (Iframe/ HttpXMLRequest) and again serialise the data andsend the contents of the second form to the server when the first one is submitted.
Using this you can also have lots more fun re dependant listboxes, lookup etc cause you have be base technology worked out.
Third idea - mentioned previously
Have an iframe on the page you are working on. Have the second form in the Iframe and then use Javascript to submit the second form using standard inter-frame communications.
So - there are many ways you can do something like this,
Enjoy
Dave
_________________
' Coding Coding Coding
Keep Those Keyboards Coding.
Raw Code!!!!!!!
|
 |
 |
Andres Rormoser
|
| Posted: 11/10/2005, 5:47 AM |
|
Peter,
Thanks for your answer, i'm going to try what you mentioned and if I manage to do it,
I will put the example here. It will be very usefull if you can automate this for future
versions.
Regards, AR
"peterr" <peterr@forum.codecharge> wrote in message
news:64372666bf2893@news.codecharge.com...
Andres,
True, if you use one form then there should be no such limitations. You just
cannot submit multiple forms together.
Also, .NET always submits the whole page as one form, so you have more
flexibility there than with ASP.
Now I guess that with ASP you could also try using just one form instead of
multiple ones. For example use just the Editable Grid form, but add a few
additional fields at the top of that form that will act as your "Master"
section. Then when the form is submitted you could process those additional
fields via custom code.
Possibly we can automate this in the future.
Thanks for pointing the example.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
---------------------------------------
Sent from YesSoftware forum http://forums.codecharge.com/
|
|
|
 |
Andres Rormoser
|
| Posted: 11/15/2005, 2:02 PM |
|
Peter,
How are you? I'm trying to do what you recommended. I made the following:
1. Create one Editable Grid for Detail Table
2. Add several TextBox before the Begin Row for the Master Table
3. In the BeforeShow Event update all the Master TextBoxes
Here the user modifies Master and Detail textboxes and press the submit button
4. In the BeforeSubmit Event update the Master Tables with the data on the Master
Textboxes
5. The EditableGrid updates/insert the Detail Records.
All it's working OK except step 4.
I can not read values of the Master TextBoxes (Textboxes with empty ControlSource outside
Begin Row/End Row Section). Here is the code:
Function ComprobanteVentaDetalle_BeforeSubmit(Sender)
'ComprobanteVentaDetalle_BeforeSubmit @20-FC746084
'Custom Code @84-73254650
' -------------------------
' declaro variables
dim cve_id, cve_bonificacion
' leo registros
cve_id = CCGetParam("cve_id",0)
cve_bonificacion = ComprobanteVentaDetalle.cve_bonificacion.value
' ejecuto procedure para insertar o actualizar ComprobanteVenta
Dim SQL, Connection, ErrorMessage
Set Connection = New clsDBConnection1
Connection.Open
SQL = "exec cve_ins_upd " & cve_id & "," & cve_bonificacion
Connection.Execute(SQL)
ErrorMessage = CCProcessError(Connection)
Connection.Close
Set Connection = Nothing
On Error Goto 0
' -------------------------
'End Custom Code
Thanks, AR
"peterr" <peterr@forum.codecharge> wrote in message
news:64372666bf2893@news.codecharge.com...
Andres,
True, if you use one form then there should be no such limitations. You just
cannot submit multiple forms together.
Also, .NET always submits the whole page as one form, so you have more
flexibility there than with ASP.
Now I guess that with ASP you could also try using just one form instead of
multiple ones. For example use just the Editable Grid form, but add a few
additional fields at the top of that form that will act as your "Master"
section. Then when the form is submitted you could process those additional
fields via custom code.
Possibly we can automate this in the future.
Thanks for pointing the example.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
---------------------------------------
Sent from YesSoftware forum http://forums.codecharge.com/
|
|
|
 |
Andres Rormoser
|
| Posted: 11/18/2005, 6:55 AM |
|
I manage to do it.
+ Add an Editable Grid for the Detail Table
+ Add Master Fields outside Begin/End Row Section
+ Change the properties of the Editable Grid:
Custom Insert Type: Table
Custom Insert: All the fields from the Detail table and the field with reference to the
master table get it from a session variable (x ej cve_id)
+ Add a BeforeShow Event to read the data of the Master Table from the database an
populate it to textboxes in the form
'Custom Code @85-73254650
' -------------------------
' declaro variables
dim cve_id, cve_fechaingreso, cve_cli_id, cve_bonificacion, cve_vco_id, cve_ven_id,
cve_vli_id, cve_vai_id, cve_mon_id, cve_vct_id
Dim SQL
Dim RecordSet
Dim UserId
Dim UserName
Dim WorkPhone
cve_id = CCGetParam("cve_id",0)
if cve_id<>0 then
' it's an update
' save id into session variable
Session("cve_id") = cve_id
' get data from database
SQL = "SELECT * FROM ComprobanteVenta WHERE cve_id="&cve_id
' Open the recordset
Set RecordSet = DBConnection1.Execute(SQL)
If DBConnection1.Errors.Count = 0 Then
If NOT RecordSet.EOF then
ComprobanteVentaDetalle.cve_fechaingreso.value = CCGetValue(RecordSet,
"cve_fechaingreso")
ComprobanteVentaDetalle.cve_cli_id.value = CCGetValue(RecordSet, "cve_cli_id")
ComprobanteVentaDetalle.cve_bonificacion.value = CCGetValue(RecordSet,
"cve_bonificacion")
ComprobanteVentaDetalle.cve_vco_id.value = CCGetValue(RecordSet, "cve_vco_id")
ComprobanteVentaDetalle.cve_ven_id.value = CCGetValue(RecordSet, "cve_ven_id")
ComprobanteVentaDetalle.cve_vli_id.value = CCGetValue(RecordSet, "cve_vli_id")
ComprobanteVentaDetalle.cve_vai_id.value = CCGetValue(RecordSet, "cve_vai_id")
ComprobanteVentaDetalle.cve_mon_id.value = CCGetValue(RecordSet, "cve_mon_id")
ComprobanteVentaDetalle.cve_vct_id.value = CCGetValue(RecordSet, "cve_vct_id")
End if
' Close the recordset
RecordSet.Close
Set RecordSet = Nothing
Else
DBConnection1.Errors.Clear
End If
end if
' -------------------------
'End Custom Code
+ Add a BeforeSubmit Event to read the Textboxes of the Master Fields in the Form and
update/insert into the table Master an get the id inserted
Function ComprobanteVentaDetalle_BeforeSubmit(Sender)
'ComprobanteVentaDetalle_BeforeSubmit @20-FC746084
'Custom Code @84-73254650
' -------------------------
' declare variables
dim cve_id, cve_fechaingreso, cve_cli_id, cve_bonificacion, cve_vco_id, cve_ven_id,
cve_vli_id, cve_vai_id, cve_mon_id, cve_vct_id, cve_emp_id
' read textboxes of master table
cve_id = CCGetParam("cve_id",0)
cve_fechaingreso = chr(34) & CCGetParam("cve_fechaingreso", Empty) & chr(34)
cve_cli_id = CCGetParam("cve_cli_id", Empty)
cve_bonificacion = CCGetParam("cve_bonificacion", Empty)
' declare variables
Dim SQL, rsGroups
' execute procedure to update/insert Master Field
SQL = "EXEC cve_ins_upd " & cve_id & "," & cve_fechaingreso & "," & cve_cli_id & "," &
cve_bonificacion
Set rsGroups = DBConnection1.Execute(SQL)
if not rsGroups.EOF and cve_id=0 then
' if it's an insert put the id inserted into cve_id session variable
Session("cve_id") = rsGroups("cve_id")
SQL = CCDLookup(Session("cve_id"),"","",DBConnection1)
end if
' -------------------------
'End Custom Code
%>
|
|
|
 |
peterb
|
| Posted: 12/05/2005, 7:29 AM |
|
WRONG: HTML standards DO ALLOW two forms to be submitted on the same page... as a matter of fact, I've been able to do it and I can have MULTIPLE FORMS submitted, do different things and go different places...
So yes, what the experts are saying is very wrong.
Andres Rormoser and PeterR
I've done it and have the code to show you...
|
|
|
 |
Rene S
|
| Posted: 12/05/2005, 10:01 AM |
|
Peterb,
Show us please...
Rene
|
|
|
 |
peterr
Posts: 5971
|
| Posted: 12/05/2005, 3:57 PM |
|
Yep
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
Andres Rormoser
|
| Posted: 12/07/2005, 5:00 AM |
|
Peter:
Congratulations! You manage to do it! I tried several ways but I could not resolve
this problem. Could you please show me how you do it?
Thanks, Andres Rormoser.
"peterb" <peterb@forum.codecharge> wrote in message
news:643945cd7d469d@news.codecharge.com...
WRONG: HTML standards DO ALLOW two forms to be submitted on the same page... as
a matter of fact, I've been able to do it and I can have MULTIPLE FORMS
submitted, do different things and go different places...
So yes, what the experts are saying is very wrong.
Andres Rormoser and PeterR
I've done it and have the code to show you...
---------------------------------------
Sent from YesSoftware forum http://forums.codecharge.com/
|
|
|
 |
|