Since this function is not specific for share_url only, call it something more general. You could also write another method that wraps this function. That way the id name "text-share-report-url" is not repeated throughout the code also.

```
function update_share_url()
{
update_value_of_text_id("text-share-report-url")
}

function update_value_of_text_id(text_id)
{
document.getElementById(text_id).value = save_chart_state();
}