Post new entry’s id on submit
Posted: 17 January 2011 03:24 AM   [ Ignore ]
Is a Really Great Dancer
RankRank
Total Posts:  61
Joined  2010-12-03

Is it possible to POST the entry_id of the entry you are creating on the form submit?

My first form action takes you to a new create entry form and i want to use the entry_id I just created in the second entry create form.

Profile
 
 
Posted: 17 January 2011 03:26 AM   [ Ignore ]   [ # 1 ]
Teen Scream
Avatar
RankRankRank
Total Posts:  3541
Joined  2009-05-29

You can add ENTRY_ID to your return parameter of your first form to have it send you to a url with your new entry_id:

return="form/page2/ENTRY_ID" 
Profile
 
 
Posted: 17 January 2011 03:58 AM   [ Ignore ]   [ # 2 ]
Is a Really Great Dancer
RankRank
Total Posts:  61
Joined  2010-12-03

So simple. Thanks!

Profile
 
 
Posted: 19 January 2011 08:25 PM   [ Ignore ]   [ # 3 ]
Is a Really Great Dancer
RankRank
Total Posts:  61
Joined  2010-12-03

Hi Rob,

Is it possible to not use the return parameter? I’m using javascript to open the form’s target (the return parameter) in a new window but if i do that the error page also opens in this new window. I’d rather leave the return parameter as it is and open a pop up with a new url with the entry id appended on the end..

That make sense?

Profile
 
 
Posted: 19 January 2011 08:35 PM   [ Ignore ]   [ # 4 ]
Teen Scream
Avatar
RankRankRank
Total Posts:  3541
Joined  2009-05-29

I’m not sure. Are you submitting the form via ajax? What’s your javascript like?

Profile
 
 
Posted: 19 January 2011 09:02 PM   [ Ignore ]   [ # 5 ]
Is a Really Great Dancer
RankRank
Total Posts:  61
Joined  2010-12-03

I have two buttons at the bottom, one simply submits the form as normal, the other submits the form and opens the pop up where users can upload files to the entry.

I need to append the entry id to the end of ‘/demo/portfolio/index.php/account/upload-asset’ so that the files are added to the correct entry.

[removed]
$(document).ready(function(){

    
var thisform = $('#form');
    $(
"#button1").click(function(){
        window
.open('/demo/portfolio/index.php/account/upload-asset''formpopup''width=600,height=800,resizeable,scrollbars');
        
thisform.submit();
    
});
    $(
"#button2").click(function(){
        thisform
.submit();
    
});
});

[removed] 
Profile
 
 
Posted: 19 January 2011 09:04 PM   [ Ignore ]   [ # 6 ]
Teen Scream
Avatar
RankRankRank
Total Posts:  3541
Joined  2009-05-29

The issue here is there is no entry_id yet, until you submit that first form. I’m not sure there’s a good way to do this.

Profile
 
 
Posted: 19 January 2011 09:06 PM   [ Ignore ]   [ # 7 ]
Is a Really Great Dancer
RankRank
Total Posts:  61
Joined  2010-12-03

So the entry id gets created on submit? Can we POST it to the new form?

Profile
 
 
Posted: 19 January 2011 09:08 PM   [ Ignore ]   [ # 8 ]
Teen Scream
Avatar
RankRankRank
Total Posts:  3541
Joined  2009-05-29

I think you’ll have to do the submit first, so you have an entry id, and then you can give them the option to pop up a new window for the image upload.

Profile
 
 
Posted: 19 January 2011 09:12 PM   [ Ignore ]   [ # 9 ]
Is a Really Great Dancer
RankRank
Total Posts:  61
Joined  2010-12-03

OK thanks Rob.

Profile
 
 
Posted: 19 January 2011 11:15 PM   [ Ignore ]   [ # 10 ]
Is a Really Great Dancer
RankRank
Total Posts:  61
Joined  2010-12-03

Sorry Rob, one more thing…

Do you know if it’s possible to display this new open pop up window button, on the same page after the submit is complete?
I can submit the form without refreshing, but I can’t then display the open pop up button with href link with the appended entry_id, this button would need to be created after the submit which is the problem.

Profile