Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Prashant on Aug 31, 2009 06:43
open dhtmlx forum
Converting form details field as HREF

Hi

I wanted one of the "details" form fields's values to be href. like in a sample code, details form have a description and location fields. and I wanted location field to be href. whenever anybody clicks on the value of the location field ,It should open the url in new tab.
Answer posted by Support on Aug 31, 2009 10:43
You can use code similar to next

  scheduler.form_blocks["link"]={
       render:function(sns){
                 return "<a href=\"#\"></a>";
       },
       set_value:function(node,value,ev){
                     node.href = value;
                     node.innerHTML=value;
        },
       get_value:function(node,ev){
                     return node.href;
       },
       focus:function(node){
      }
}


scheduler.config.lightbox.sections=[
{ name:"description", height:200, map_to:"text", type:"my_editor" , focus:true},
{ name:"link_section", height:72, map_to:"name_of_link_field", type:"link"},
{ name:"time", height:72, type:"time", map_to:"auto"}
]
Answer posted by Prashant on Aug 31, 2009 22:53
Many thanks to you guys for this wonderful solution. but the problem of this approach is that when you want to create a new event then this form field  always renders as link. therefore, you can not add any values to it.

It would be wonderful If I can get this link functionality only when the form renders not when you are opening it for creating new events.

-Prashant