I have tried so many variations. Basically, we want to validate event dates from sentences. We have publication date, and I am using extracted dates if we find one, but sometimes sentences would refer to "last Friday". So I am using a block like this:
I have tried setting the value and also textContent of event_date, but none of these seem to work and save the data in prodigy, although it does update the browser window with the value. If I type in the event_date text window, then it saves the data. But prodigy does not seem to recognize there is updated text in the field when it is populated with the copy assignment statements. I also tried javascript, but I can't get it to recognize the method call.
Could you share a screenshot of your interface? It's a bit unclear to me if an event date is mainly a label in the spans_manual interface or if it is a label from the choice interface.
Just to be clear, this would copy the value from the cal_date element? Is that an element in the spans_manual element? I'm partially asking because I'm wondering what needs to happen in the front-end and if your intended action is perhaps better handled on the Python side of things using the before_db callback.
event_date is the field_id of the text_input
cal_date is the id of the calendar object
I was using the text_input to get the value back into the annotation for the calendar date selection.
The id values for all the choices are below and there is no overlap of id values.
{"id": "pubdate", "text": " use publication date"},
{"id": "exdate", "text": " use extracted date"},
{"id": "moddate", "text": " use selected calendar date"}
The text_input (event_date) works if I type into the field but does not work if I assign it a value from the calendar object. Maybe I don't have the assignment correct to trigger that the field changed but the browser view does get updated.
I don't think i can use the before_db on the python side, because i need to get the value from the browser into the annotation.
Is the calendar rendered with custom html? You blocks definition earlier suggests that you're not using a custom html block. But I guess it might be rendered as part of the choice view.
I worry that the html block itself is not aware of the textfield. It feels like it might get fixed by adding custom javascript via the config. This might have access to the entire doc.
Is it possible for you to send a minimal viable example my way? Maybe the custom recipe code together with a few examples? It might be easier for me to debug/understand this with the example in front of me.