Navigation strips (changes) link needed by form in modal window
I have a modal window contact form that is controlled by javascript & ajax and accessed by a link to the ID of the form. eg, href='#formID'
FuelNav won't allow this link address -- in fact, it turns it into href='sitename/formID'
If I hardcode the link (not use the fuel navigation menu), then the contact form works as intended.
Any similar javascript will have this issue
The suggestion is to allow for such links in future versions
Thanks
Comments
$location = (preg_match('/^#/', $val['location'])) ? $val['location'] : site_url($val['location']); $str .= '<a href="'.$location.'"'.$attrs.'>'.$label.'</a>';
Does it fix your problem?For anyone else who may need this, the line to replace is a call to the anchor subroutine, and the appropriate code turned out to be
$location = (substr($val['location'],0,1)=='#') ? $val['location'] : site_url($val['location']); $str .= '<a href="'.$location.'"'.$val['attributes'].'>'.$label.'</a>';
Your suggested change is likely also needed for completeness (in what I have it is about a dozen lines further down)
There also needs to be a change to the navigation model in the on_before_clean callback to not strip the #. What I now have is
function on_before_clean($values) { if (empty($values['nav_key'])) $values['nav_key'] = $values['location']; // if the path is local, then we clean it if (!is_http_path($values['location'])) { // check for # and don't delete it if there if ( !(substr($values['location'],0,1) == '#') ) { $values['location'] = str_replace('/', '___', $values['location']); $values['location'] = url_title($values['location']); $values['location'] = str_replace('___', '/', $values['location']); } } return $values; }
It would likely be safer to keep some of the other tests, but this was expedient.
Thanks.
Nav settings: http://dev.whats-on.co.nz/assets/images/grab.jpg
Click 'test' in the left of the footer here: http://dev.whats-on.co.nz
Apologies if I've misunderstood.
The line numbers didn't match up well. Perhaps someone had already posted a fix that I missed.