Keyword

Close Item Form on Save

  • Nelson Elliott
  • Nelson Elliott's Avatar Topic Author
  • Offline
  • Junior Member
More
11 years 9 months ago #115108 by Nelson Elliott
Close Item Form on Save was created by Nelson Elliott
How do I make a front-end Item Edit Form close upon hitting the "Save" button? I dislike asking users to click both "Save" and "Close" for a simple form.

I'm sure this is fairly simple, but I'm a total javascript noob and haven't been able to find the answer by searching.

Thanks,
Nelson

Please Log in or Create an account to join the conversation.

  • Franz Wohlkönig
  • Franz Wohlkönig's Avatar
  • Offline
  • Platinum Member
More
11 years 9 months ago #115109 by Franz Wohlkönig
Replied by Franz Wohlkönig on topic Re: Close Item Form on Save
Hy Nelson,

this is not a solution, its a wish: I want a 3rd button like joomla: "save&close", cause i dont want always reopen after saving, if i want to work more on it.

Greetings
Franz

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
11 years 9 months ago #115110 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: Close Item Form on Save
Hello Franz and Nelson,

Since you are familiar with overriding (for more info -- getk2.org/documentation/tutorials/174-templating-with-k2-and-the-concepts-of-sub-templates ) you need to override itemform.php .

To be more precise the save button is:
Log in  or Create an account to join the conversation.

  • Franz Wohlkönig
  • Franz Wohlkönig's Avatar
  • Offline
  • Platinum Member
More
11 years 9 months ago #115111 by Franz Wohlkönig
Replied by Franz Wohlkönig on topic Re: Close Item Form on Save
Hy Krikor,

1st: You make a good Job in answering all those questions.

itemform is in a modal-window, so i cannot apply another button - right?

Greetings
Franz

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
11 years 9 months ago #115112 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: Close Item Form on Save
Thank you Franz for your kind words.

I don't think that would be optimal (frontend and backend are not the same view) but if you need to add a button you need to copy the behaviour from your k2.js

If you know your way around JS the function starts with
Log in  or Create an account to join the conversation.

  • Nelson Elliott
  • Nelson Elliott's Avatar Topic Author
  • Offline
  • Junior Member
More
11 years 9 months ago #115113 by Nelson Elliott
Replied by Nelson Elliott on topic Re: Close Item Form on Save
Krikor,
Many thanks! That was very easy to add and worked perfectly!

-N

Please Log in or Create an account to join the conversation.

  • Nelson Elliott
  • Nelson Elliott's Avatar Topic Author
  • Offline
  • Junior Member
More
11 years 9 months ago #115114 by Nelson Elliott
Replied by Nelson Elliott on topic Re: Close Item Form on Save
Agh. Not perfectly actually. It seems not to save new items when I close the form with that method. . .

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
11 years 9 months ago #115115 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: Close Item Form on Save
Hello Nelson which method did you follow? the window.close() one or the modal box?

Please Log in or Create an account to join the conversation.

  • Nelson Elliott
  • Nelson Elliott's Avatar Topic Author
  • Offline
  • Junior Member
More
11 years 9 months ago #115116 by Nelson Elliott
Replied by Nelson Elliott on topic Re: Close Item Form on Save
Ach. Sorry. Apparently, I unsubscribed to this thread.

I am currently working on the window. My configuration opens a new window when users click a "New Item" menu item. When they edit items they already created, it opens a modal box.

It would be nice to get both of those functioning in a consistent manner, but for now I am concerned with the window, as adding new items is the most important thing.

Please Log in or Create an account to join the conversation.