Link button in Details Form

Hello,

I would like our future users to be able to access their event page directly through the details form. How am I able to generate a dynamic link based on the events database ID on this form?

Thanks,

Tim

Hello, Tim.

I didn’t quite get your question so will provide some related links :slight_smile:
You can check how to add button on section header.
Also you will need information for what event button is clicked:

var ev = scheduler.getEvent(scheduler.getState().lightbox_id);

where scheduler.getState().lightbox_id = id of the event currently opened in the lightbox.

Best regards,
Ilya

Sorry that really didn’t make sense… too tired.

I simply want to create a button in the details lightbox. Clicking the button should take the user to a page with the event id in the URL.

Example: localhost/view_booking/12

I found the example code of how to create the button however I am struggling to be able to do anything with it.

scheduler.locale.labels.button_link="Show Booking"; scheduler.form_blocks.textarea.button_click=function(index, src, sec, data){ //window.location = 'cool'; alert('hello'); //called on button click // index - index of section // sec - html element of section header // sec - html element of section editor }
The alert is not shown. Nothing happens. No script errors. Any clues?

Thanks,

Tim

Hello,

This is still a problem and I haven’t been able to get it to work.

Something strange I have noticed is that the button will work if opened in a “Create New Event” lightbox. However clicking on an existing event and then trying to click on the button shows nothing. There is also no javascript errors shown in my consoles.

Any ideas?

Thanks,

Tim

Ok,

I have determined that the button is not working when i include the read only extension file. Is there any way I can over-ride read only mode for just the button?

Thanks,

Tim

So I have now abandoned this idea and am instead building my own custom form using the example given in /customisation/16 Custom Form.html

My only question is how can I tell if the client is making a new event or is editing an existing one? I need to know this so I can alter the form fields accordingly (ie, remove the Show Booking Button on the Add New Event form).

Thanks,

Tim

Hello, Tim.

if(scheduler._new_event){ // new event } else { // existing event }

There are two options: edit source code (I can show what and there), create custom section with your own button in the section header or create completely custom lightbox form.

Best regards,
Ilya

Ilya,

I’m trying to do something similar, and running into a problem with what you recommended initially.

Here’s my code:

eid=scheduler.getState().lightbox_id; alert(eid);

It should be alerting the id of the event. Instead it is alerting ‘undefined’.

I’m stuck, and confused. Any help is appreciated.

Thank you,
Rob Morin

Ilya,

If it matters, I’m putting this in the ‘render:function(sns){’ portion of the custom section definition.

Thank you,
Rob

Hello,

It matters. render function is called only once (literally once, not per event) to create lightbox object. Set value on the other hand is called each time lightbox is displayed to set value in corresponding section (but it also can be used to create and display some other objects: dhtmlxform, combo and so on).
In your case you need to move logic you are trying to implement in the set_value function.

Best regards,
Ilya