not able to retrieve lightbox_id in dynamic link

This might explain my issue

I have a ‘save no close’ button that generates my event id that I want to use as a link

The button works and the new_id is created which I assign to the lightbox_id

My form_blocks link has javascript but it doesn’t pickup the select_id???

scheduler.getState().lightbox_id works in the onLightboxButton event (L.465)

but not in a javascript link in the form_blocks section (L.522)

(I’ve tried using the select_id and even localstorage with no success either)

I must not be understanding something.

TIA,

David


Data in form is not updated after event saving.
You need to call something like

scheduler.endLightbox(); scheduler.showLightbox(id);

to force the lightbox repainting with new data.

I’m doing that on line 450?

-D

If you have not changed data saving logic, it will work in async mode.
So in the above case, after clicking on button

  • lightbox closed
  • new data send to server
  • lightbox repopened ( with old data )
    … async. delay …
  • response retrieved from the server side
  • id changed

You need to modify data saving to be sync, or duplicate reopening logic in the onEventIdChange handler.

I’m still not sure but will keep trying

-D

All I need to do is access the _lightbox_id

alert(_lightbox_id) ???

I see it in firebug in the DOM, why can’t I get the value?

I think the solution is easier than I think…

I want to use that value with Javascript to call a url window.location(‘blah/’ + <<<????>>>)

-D

I found it!!!

var foo = scheduler.getState();
var bar = $(foo).attr(‘lightbox_id’);

The only way I could get the ID

Phiew!

-D

Seems it works sometimes. Put a five second delay in but still nothing. Maybe the delay needs to be put somewhere else?

-D

This probably illustrates my point.

I have to click the ‘Save2’ button a 2nd time to get the real id

I put a delay in at line 511 but to no avail.

even though the schedule._lightbox_id is set correctly, and I can’t get it?

TIA,

David


My ‘save no exit’ button in the lightbox works…

I figured it out!!!

You have to dynamically pull the id rather than getting the id in the form_blocks.

-D

// further down

scheduler.form_blocks[“link_editor”] = {
render:function(sns) {
var id = scheduler.getState().select_id;
var readonly = (id === null) ? 0 : this.getEvent(id).readonly;

  var $links = '<a onclick="show_new_id()">show id</a>';                    

return $links;
},
set_value:function(node,value,ev){
},
get_value:function(node,ev){
},