I’d like to be able to show a ‘combo’ field if the event is new (the ‘+’ button was clicked), or a read-only ‘text’ field if editing an existing event.
I assume it’s down to having both defined in scheduler.config.form[] with one hidden. I have the combo loading data and working fine.
Which event should I target, and what property should I access to figure out if it’s a new event (would it be $$(“scheduler”).getCursor() or something else?), and is using ‘hidden’ the best way to do this?
That’s great! The next part of this problem is that the field we’re talking about is the “text” field. How do I name both elements ‘text’ without conflicts?
Would it work if I had a datastore of some kind that was named ‘text’, and then use that to load the data into and out of the two (differently named) fields?
text1 and text2 will be available using the following:
var itemId = $$(“scheduler”).getCursor(); // id of the selected item
var data = $$(“scheduler”).item(itemId);
$$(“scheduler”).item(itemId).text1 = “…”;
Both new fields will be sent with the save requests. The example of php script
I’ve ended up taking making a different solution. The field with id ‘text’ is the combo, and I have a field of type ‘text’ with ID of clientname.
Your hide()/show() code above is working great.
What I’m doing is watching for a cursor change and updating the ‘client’ field with the following:
$$("scheduler").attachEvent("onAfterCursorChange", function(id){
var clientID = getClientIDFromEventID(id);
var clientFullName = getClientFullnameFromID(clientID);
$$("scheduler").$$("client").setValue(clientFullName);
console.log('clientFullName: '+clientFullName);
});
[getClientIDFromEventID() and getClientFullnameFromClientID() are two functions I have written]
The correct ‘clientFullName’ is written to console.log, but it seems to be being written over when the edit form is shown, as the value goes back to “”.
How should I be setting the text field so it shows the correct value once show() is called?