SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Oct 2013
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Exclamation [drupal ] Hash character (#) automatically translated to "%23" when form is loaded

    Hi, I want to add a link like this to a form

    Code:
    <a id="addButton" href="#" style="display: inline-block;"></a>
    So I use this code


    PHP 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.

  2. #2
    SitePoint Addict
    Join Date
    Sep 2005
    Posts
    271
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    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.

  3. #3
    SitePoint Member
    Join Date
    Oct 2013
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I finally found out that using #markup can make it work


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •