Showing a different set of fields in view and edit mode

Hi everyone,

well, I'm probably stupid, because I believe that what I want to achieve must be very easy, but somehow, it just doesn't want to work the way I'd like it to. :-(

Here's the deal: I'm on Sugar 9.0.2, and for the Accounts module, I'd live the detail view that you get when you open an account to show a slightly different set (or order) of fields from what you get when you hit the "edit" button and are in edit mode.

So, what did I do? Well, there was already a

custom/modules/Accounts/clients/base/views/record/record.php

file present, which I just copied to

custom/modules/Accounts/clients/base/views/create/create.php

While I was at it, inside of the file I changed

$viewdefs['Accounts'] =
array (
'base' =>
array (
'view' =>
array (
'record'

to

$viewdefs['Accounts'] =
array (
'base' =>
array (
'view' =>
array (
'create'

Then I made some changed to the fields defined in the file itself, and after a quick repair & rebuild, upon entering the edit mode of an account, I saw ... no difference at all. Stuff still looked exactly the same as it did in the normal "record view". However, what I noticed: When I create a new account, I actually get shown the fields in the way I've specified them in my new "create view". So for create it works, but not for edit.

"Great", I thought, maybe I'll have to explicitly specify a custom edit view then, so I quickly created

custom/modules/Accounts/clients/base/views/edit/edit.php

$viewdefs['Accounts'] =
array (
'base' =>
array (
'view' =>
array (
'edit'

but that didn't do anything either.

Very strange - I#m certainly doing something very simple wrong, but I have no idea what it is. Therefore, if anyone can point me into the right direction what I can do to customize my edit view, just like it's already worked for my create view, I'd be really, really grateful!

Thank you in advance!
Nils

Parents
  • You are probably going to have to do a lot more than that, currently the edit view is both detail and edit, as you know, and so to go from th edetail view to the edit view  doesn't require a screen refresh. In your world you would have to have separate views and then recode the edit button function to do a lot more than it does now. Instead of just enabling edit mode on the current view it would have to paint a new view and then enable the edit mode on that view. And then when you hit save it's going to have to re-render a different view and turn off edit mode.

    Its surly possible but its going to be a choppy user experience and I really can't think, off the top of my head, an easy way to do it. I'm sure it's possible, but it's going to be a lot more complex than what you have in your outline.

    It might be easier to code something that hides some fields on Detail View and others on Edit View so that when you press the edit button it simply hides/shows and enables Edit mode.   That can all be done in record.js and record.php.  It will break studio to have 2 copies of fields on the screen but it will work.

Reply
  • You are probably going to have to do a lot more than that, currently the edit view is both detail and edit, as you know, and so to go from th edetail view to the edit view  doesn't require a screen refresh. In your world you would have to have separate views and then recode the edit button function to do a lot more than it does now. Instead of just enabling edit mode on the current view it would have to paint a new view and then enable the edit mode on that view. And then when you hit save it's going to have to re-render a different view and turn off edit mode.

    Its surly possible but its going to be a choppy user experience and I really can't think, off the top of my head, an easy way to do it. I'm sure it's possible, but it's going to be a lot more complex than what you have in your outline.

    It might be easier to code something that hides some fields on Detail View and others on Edit View so that when you press the edit button it simply hides/shows and enables Edit mode.   That can all be done in record.js and record.php.  It will break studio to have 2 copies of fields on the screen but it will work.

Children
No Data