This topic is locked
[SOLVED]

 $inline is worthless? How to use?

7/29/2011 8:55:42 AM
PHPRunner General questions
F
FunkDaddy author

I'm confused on how to use the $inline variable (parameter) that is natively available in the "Before record Updated" and After record updated" events in PHPR 5.3 (7474).
I thought I could use this var to distinguish between an "inline" edit vs a "regular" edit.
Simplified example of what I was hoping to achieve:

  1. Say you have an edit form with 10 fields.
  2. I want to add only the first 5 fields to the inline edit functionality (so I can edit on list page only those first 5 fields... let's call them A thru E)
  3. I want to add the last 5 fields (let's call them F thru J) to the regular edit popup page.
  4. I would like to have different behaviors when saving the edit form (in the before record update event) based on whether the edit form is being saved while in inline edit mode vs. when it is being saved from the popup mode.
    I tried examples shown in the forums (there aren't many) and read the documentation... however, the $inline variable basically seems to only acknowledge that, "yes" you are editing the form. Well, that seems worthless to me since I already know that by virtue of using code in the before record updated event (which already tells me that I am editing the form!). Am I missing something here? I tried using that variable in various ways such as...



if($inline){

$values["field1"] = 1;

}

//Also tried

if(!$inline){

$values["field1"] = 1;

}


The behavior of either of the two snippets I show do in fact act differently, but it doesn't seem to distinguish whether I'm saving from inline or popup form!
Anyone have any suggestions or alternatives to using this variable/parameter?
Thanks,

C
cgphp 7/29/2011

FunkDaddy,
it seems a bug of popup. Uncheck the option "Show in popup" for edit and add pages and make a new test. It should work !

F
FunkDaddy author 7/29/2011

Thanks CGPHP....
I was afraid that would be the case...I have not tried that since not using the popup is not an option. The web form I created relies very heavily on the popup due to the wizard like interface being used as required by the client.
It would be great to add a feature in a future release that gives users a separate "JS on load" event for inline edit/add types; as well as before/after update event for inlines. I've made heavy use of inline edit combined with popup edit for same form to create a step-by-step wizard that keeps mirrors a desktop experience. Depending on how the new PHPR 6.0 version deploys the new templating feature I'll create a version of my wizard for the "runner exchange" marketplace.
Sergey & Crew... is this a know "bug" or simply a limitation of the current design in 5.3?
Thanks,

Sergey Kornilov admin 7/29/2011

This behaviour is by design. Popup mode is considered "inline". $inline variable will be empty in the case of regular edit and will be set to 1 in case of inline and popup edit.