⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Add Edit Link to View Form



rjsig
  • profile picture
  • Member

Posted 01 May 2012 - 19:56 PM

Hello everyone,

I've made a few changes to the gc library and created a "view" js and "view" view such that a logged in user who is not an administrator can view more info in the view form than is practical to display in the list (mobile app), but not change it. This is working fine.

Logged in users may "Add" Venues to assist in populating desirable local Venues, and should be given default permissions to change the particular Venues they have entered.

[b]First thing I'm not sure how to do[/b] with gc - how to automatically add the currently logged-in user to a many-to-many "users-venues" table at the successful completion of adding a new Venue in the "venue" table. Would love help on this as I have several other situations to do essentially the same thing.

[b]Second thing I'm not sure how to do with gc[/b] - I would like a currently logged-in user to see both a "view icon" which I have working, and additionally an "edit icon" in the Venue List for only those Venues that user has authorization to edit. The authorization would be in the many-to-many table "users-venues" table mentioned earlier which contains the following logical fields:

[b]Third thing I'm not sure how to do with gc -[/b] If a currently logged-in user chooses to "View" a Venue rather than "Edit" one they are authorized to edit, I would like to show an "Edit Button" on the "View" form so that, once viewing, they could edit if they choose to without first returning to the table and choosing the edit icon. I almost have this bit working, but am stuck rather stupidly on calling the "Edit Form" from the "View Form" with the proper state in place, or the proper user id in place, or such that it will actually save the edited record once displayed. I've had it in several conditions so far but am no longer making progress - thus this request.

I am more than impressed with gc and what I have read as responses in the forum and look for to learning from your replies.

Thanks - Randy

HumbleMonk
  • profile picture
  • Member

Posted 01 May 2012 - 22:48 PM

For your first problem use this callback: http://www.grocerycrud.com/documentation/options_functions/callback_after_insert

rjsig
  • profile picture
  • Member

Posted 04 May 2012 - 11:48 AM

Thank you HM. Looks like I can use that code to accomplish my first purpose. Will try today. I had clicked to receive email on responses but didn't get one so came and looked and here it was.

Now could some of my brother/sister coders please help on the other two needs? I'm stuck going in circles.

-- Randy

simonfrank
  • profile picture
  • Member

Posted 04 May 2012 - 14:45 PM

For no. 2 would the column call back work for this? http://www.grocerycrud.com/documentation/options_functions/callback_column. Failing that you could modify the theme.

For no.3 it would be great to have an add action function which adds to the bottom of the form, as I need something for that. If I manage to hack something up I'll post it.

InnaAbu46
  • profile picture
  • Member

Posted 21 May 2012 - 14:28 PM

"Исрамед-портал" - некоммерческая организация финансируемая
частным благотворительным фондом.

info@isramed-portal.com
Все консультации и услуги бесплатны.