This topic is locked

Detail Button

12/17/2009 2:45:44 PM
ASPRunnerPro General questions
C
cdlamore author

OK I have been trying for weeks. I hope someone can help.
I have for this scenario two tables

PerinatalData (Master Table) and FetalComplications (Detail Table)
When Nurse is entering a new patient in the PerinatalData table they have a checkbox to check if there are "Fetal Complications" called fetalcomps

Next to this checkbox is a "MORE" button that I want to redirect to details table.
I was able to successfully setup the database to insert records in both tables when you click submit, however this button is causing me trouble.
What I need is that if they check the box and click "MORE" the existing form with save in both tables and then redirect to the detail table.
Currently this is the code I have -
On the VB tab for PerinatalData Add I have a code snippet that has this -
response.write "<input type=button value=More class=button onclick=""window.location.href='FetalComplications_edit.asp?editid1=" & request.querystring("editid1") & "&updaterecord=yes';"">"
However this does not save anything anywhere however does successfully redirect to the record I am wanting in the details table.
I also have Event for the record adding when submit key is hit -
It is in "After record added"

'** Insert a record into another table ****
dal.FetalComplications.RECNO=values ("RECNO")

dal.FetalComplications.LASTNAME=values ("LASTNAME")

dal.FetalComplications.FIRST=values ("FIRST")

dal.FetalComplications.FETALCOMPS=values ("Fetalcomps")

dal.FetalComplications.Add()
AfterAdd=True
Trouble is I cannot get both to work for me. If the user clicks the "MORE" button all work is lost. How do I get my cake and eat it too?
I would love if the "MORE" button caused a pop up box and left the existing record up behind it after submitting to both tables, but a simple redirect after creating both records would be great too.
Please let me know if I missed any details!

C
cdlamore author 12/18/2009

I think the most pressing detail I would like to learn is how to make that button on the master table which I have doing what I want submit, update the record before it redirects to the detail table form...since it has to send over some of the values to the details table in the add scenario.

J
Jane 12/18/2009
C
cdlamore author 12/22/2009

OK I did as you suggested with your link -
Copied Save button, changed it to "MORE" code looks like this now on the html side -
[indent]<INPUT class=button id=more value=More type=submit>[/indent]
Then in Events under Add page after record added I have this -
[indent]dal.FetalComplications.RECNO=values ("RECNO")

dal.FetalComplications.LASTNAME=values ("LASTNAME")

dal.FetalComplications.FIRST=values ("FIRST")

dal.FetalComplications.FETALCOMPS=values ("Fetalcomps")

dal.FetalComplications.Add()
if GetRequestForm("More")="More" then

response.write """window.location.href='FetalComplications_edit.asp?editid1=" & request.querystring("editid1") & "';"">"

end if
AfterAdd=True[/indent]
I am still gettig successful adds to both tables however redirect is not occuring. It is staying in the add page for the master table and giving me the successful record added message.
Sorry for the bother, I just know I am so close and I have been working on this one silly problem for so long!

C
cdlamore author 12/22/2009

I just want to add one more thing -
I tried both of these as well with no luck...
[indent]

Response.Redirect "FetalComplications_edit.asp?mastertable=PerinatalData&masterkey1=" & keys("RECNO")
Response.Redirect """window.location.href='FetalComplications_edit.asp?editid1=" & request.querystring("editid1") & "';"">
[/indent]

J
Jane 12/24/2009

Christie,
please see my changes below:

if GetRequestForm("more")="More" then

response.write """window.location.href='FetalComplications_edit.asp?editid1=" & request.querystring("editid1") & "';"">"

end if

C
cdlamore author 12/28/2009

Jane,
Thank you for the response. Your solution appears to be very close to what I had posted originally. I did follow your advice and inserted your code and it is still successfully updating both tables but no redirect after add.
I was looking through the html code and did not see (version 6.1 build 2135) the entry regarding the form posting as I remember from somewhere you sometimes had to change that settings in order to allow a redirect during a post. I know in the previous versions I could see the form command in the html, however in this version I do not see where it stores that information or if I am simply barking up the wrong tree.
[indent]
dal.FetalComplications.RECNO=values ("RECNO")

dal.FetalComplications.LASTNAME=values ("LASTNAME")

dal.FetalComplications.FIRST=values ("FIRST")

dal.FetalComplications.FETALCOMPS=values ("Fetalcomps")

dal.FetalComplications.Add()
if GetRequestForm("more")="More" then

response.write """window.location.href='FetalComplications_add.asp?editid1=" & request.querystring("editid1") & "';"">"

end if
[/indent]
Or maybe two seperate events? It just appears to me that it goes through the add process but does not go onto the if statement.

J
Jane 12/29/2009

Christie,
I recommend you to download and install latest ASPRunnerPro 6.1 build 2503:

http://www.xlinesoft.com/asprunnerpro/download.htm
If it doesn't help publish your project on Demo Account and open a ticket at http://support.xlinesoft.com sending a URL to your pages along with instructions on reproducing this error.