Hi, I want to add a link like this to a form
<a id="addButton" href="#" style="display: inline-block;"></a>
So I use this code
$form['addButton'] = array(
'#attributes' => array('style' => 'display: inline-block;'),
'#type' => 'link',
'#title' => t(''),
'#href' => current_path() . "#",
'#id' => 'addButton',
The problem is, when I load the form, the link translated to "http://localhost:8082/admin/config/zoho/test%23" instead of "http://localhost:8082/admin/config/zoho/test#". Can someone please tell me how to fix this error? I'm desperate. I cannot test my other code because of this stupid bug.
Try putting %23 instead of the hash; something is rendering the # character to not be displayed properly, something like htmlentities. I don't know drupal so I'm not sure where you would look for this issue.
I finally found out that using #markup can make it work
This topic is now closed. New replies are no longer allowed.