Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Firing a save event without seeing form 29 Sep 2015 11:41 #13525

  • MorganL
  • MorganL's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
  • Posts: 438
  • Thank you received: 53
Let me try and explain this..

I have a grid where users can browse deals.. if they find on they like one, they click 'Claim' and this brings up a model form for the 'ClaimedDeals' window, which has lots of prefilled HIDDEN fields by using filter_item in the URL (dealid for example) and auto propagates Created By, Creation Date. As soon as they click SAVE and CLOSE.. the new record is created without them actually needing to do anything

IN technical terms.. when user is on URL

index.php?option=com_mycomponent&view=deals

They click a button that opens in a modal

index.php?option=com_mycomponent&view=claimdeal&filter_dealid=3

The modal window has ALL fields hidden as they are prepopulated by the URL or autogenerated by the core system.. so all the user has to do is click SAVE&CLOSE (relabelled - I understand the ruies and want to claim this deal) and the new record is created in claimdeals with the logged in user as the created_by and owner of the record

Ideally, I would prefer to skip this modal window stage altogether as it is not needed

Can I fire a save event that will create a new record and replace this modal, with some information passed via a BUTTON or URL without having to open a MODAL window or FORM screen
Morgan Leecy MCSE

Novell / Linux
PHP. MYSQL, Apache, node.js
Coldfusion, JQuery, HTML5
Joomla

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

Firing a save event without seeing form 29 Sep 2015 11:45 #13526

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
Do it on the display function of your page. It will create a new record every time the page is called.

This is the code to use with an item model
$model->save(array(
  'id' => 0,
  'my field' => 'My value'
));

$item = $model->getItem()
Coding is now a piece of cake
The following user(s) said Thank You: MorganL

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

Last edit: by admin.

Firing a save event without seeing form 29 Sep 2015 12:35 #13529

  • MorganL
  • MorganL's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
  • Posts: 438
  • Thank you received: 53
Thats pretty powerful stuff, I will have to have a play as its a bit more powerful that I require, but still doable as I can just make a view that says

'Well done, you have claimed the deal' and fire the event. The user then closes the window as normal!
Morgan Leecy MCSE

Novell / Linux
PHP. MYSQL, Apache, node.js
Coldfusion, JQuery, HTML5
Joomla

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

Firing a save event without seeing form 29 Sep 2015 12:38 #13530

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
Cool !

The best, when you done that is to give this process work to the controller. Better coding.
The view, just call the controller task. Redirection will not occurs after process if you create a single function.
Coding is now a piece of cake

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

  • Page:
  • 1
Time to create page: 0.080 seconds

This is what you call a component builder. I was able to master using this in a very short time and the resulting component works like a charm. Not just a basic component builder but a fully working component builder with forms fields tables all ready to go. You can make the list and item views to display in the front and back end. Also there is a great forum just starting to evolve and I'm sure this will grow very rapidly when you all realise how good this tool is.
Kevin (JED)

         

Get Started