0
Welcome Guest! Login
0 items Join Now

SOLVED Form fields to match JS

    • Designhow's Avatar
    • Designhow
    • Elite Rocketeer
    • Posts: 1013
    • Thanks: 0

    SOLVED Form fields to match JS

    Posted 11 years 1 month ago
    • I am trying to add this search function to this website www.medisysdemo.com/home/index.html

      I cant seem to get this to work right, any genius wanna help a brother out :)


      Here is the form html:
      <div class="search-wrapper">
      <form method="post" action="/">
      <p>
      <input name="search" id="s" type="text">
      <button type="submit" class="submit-search">Search</button>
      </p>
      </form>
      </div>

      Here is the js:

      <SCRIPT language=JavaScript>
      var NS4 = (document.layers);
      var IE4 = (document.all);
      var win = window;
      var n = 0;
      function findInPage(str) {
      var txt, i, found;
      if (str == "")
      return false;
      if (NS4) {
      if (!win.find(str))
      while(win.find(str, false, true))
      n++;
      else
      n++;
      if (n == 0)
      alert("Not found.");
      }
      if (IE4) {
      txt = win.document.body.createTextRange();
      for (i = 0; i <= n && (found = txt.findText(str)) != false; i++) {
      txt.moveStart("character", 1);
      txt.moveEnd("textedit");
      }
      if (found) {
      txt.moveStart("character", -1);
      txt.findText(str);
      txt.select();
      txt.scrollIntoView();
      n++;
      }
      else {
      if (n > 0) {
      n = 0;
      findInPage(str);
      }
      else
      alert("Sorry, we couldn't find.Try again");
      }
      }
      return false;
      }
      </SCRIPT>

      <FORM name=search onsubmit="return findInPage(this.string.value);">
      <P align=center><FONT size=3>
      <INPUT
      style="BORDER-RIGHT: #666666 1px solid; BORDER-TOP: #666666 1px solid; FONT-SIZE: 8pt; BORDER-LEFT: #666666 1px solid; BORDER-BOTTOM: #666666 1px solid"
      onchange="n = 0;" size=16 name=string></FONT><BR><INPUT style="BORDER-RIGHT: #ffffff 1px solid; BORDER-TOP: #ffffff 1px solid; FONT-SIZE: 8pt; BORDER-LEFT: #ffffff 1px solid; BORDER-BOTTOM: #ffffff 1px solid; FONT-FAMILY: Tahoma; BACKGROUND-COLOR: #aaaaaa" type=submit value=Search in page ><center><font size=2pt;><font family=Times New Roman;><b>


      <font face="Tahoma"><a target="_blank" href=" www.javascriptfreecode.com/ "><span style="font-size: 8pt; text-decoration: none">JavaScript Free Code</span></a></font>

      <BR>
      </P></FORM></DIV><BR><!-- /Search-->
    • Last Edit: 10 years 11 months ago by Designhow.
    • prim's Avatar
    • prim
    • Preeminent Rocketeer
    • Posts: 17290
    • Thanks: 217

    Re: SOLVED Form fields to match JS

    Posted 11 years 1 month ago
    • I saw this on your site: Failed to load resource: the server responded with a status of 404 (Not Found) www.medisysdemo.com/home/js/search.js

      Also, i think that this JS looks like something from the 90's. I'm not sure if it would work in modern browsers.

      Correct me if i'm wrong 8)
    • Please reply with a direct link to the issue & create a new thread for each new issue.

      A template is only as good as the content that goes into it ;) - DanG
    • Who?'s Avatar
    • Who?
    • Preeminent Rocketeer
    • Posts: 25562
    • Thanks: 613
    • Joomla freelancer

    Re: SOLVED Form fields to match JS

    Posted 11 years 1 month ago
    • What exactly is the issue with this?
    • Check my services at: Mihha-Vision
    • Designhow's Avatar
    • Designhow
    • Elite Rocketeer
    • Posts: 1013
    • Thanks: 0

    Re: SOLVED Form fields to match JS

    Posted 11 years 1 month ago
    • Trying to implement a search function. It is just a dummy search right now (static) I am in need of a good .js file and a way to integrate it into the search field.

      Here is the form html:
      <div class="search-wrapper">
      <form method="post" action="/">
      <p>
      <input name="search" id="s" type="text">
      <button type="submit" class="submit-search">Search</button>
      </p>
      </form>
      </div>
    • prim's Avatar
    • prim
    • Preeminent Rocketeer
    • Posts: 17290
    • Thanks: 217

    Re: SOLVED Form fields to match JS

    Posted 11 years 1 month ago
    • Why not use RokAjaxSearch? There's no need to re-invent the wheel.
    • Please reply with a direct link to the issue & create a new thread for each new issue.

      A template is only as good as the content that goes into it ;) - DanG
    • Who?'s Avatar
    • Who?
    • Preeminent Rocketeer
    • Posts: 25562
    • Thanks: 613
    • Joomla freelancer

    Re: SOLVED Form fields to match JS

    Posted 11 years 1 month ago
    • I would strongly suggest you to ask this in official Joomla forum where you could get answers that will help you to do this custom work 8)
    • Check my services at: Mihha-Vision
    • Designhow's Avatar
    • Designhow
    • Elite Rocketeer
    • Posts: 1013
    • Thanks: 0

    Re: SOLVED Form fields to match JS

    Posted 11 years 1 month ago
    • Its not Joomla :oops: Prim

      Its an HTML5 website.

      Igor I will try posting somewhere else.
    • Who?'s Avatar
    • Who?
    • Preeminent Rocketeer
    • Posts: 25562
    • Thanks: 613
    • Joomla freelancer

    Re: SOLVED Form fields to match JS

    Posted 11 years 1 month ago
    • Please post questions related to Joomla, WordPress or phpbb3 in this forum. We really can't provide support for all the problems in the world no matter how good we are 8)
    • Check my services at: Mihha-Vision
    • PimPam's Avatar
    • PimPam
    • Newbie
    • Posts: 6
    • Thanks: 0

    Re: SOLVED Form fields to match JS

    Posted 10 years 11 months ago
    • Hi guys,

      Bouncing on this related issue, I would like to know if it's possible somehow to insert a JQuery function on the rokajaxsearch form ?

      My purpose is to track the search terms in Analytics, using a Hit Callback function to trigger an analytics event. This event will capture and pass on the value field.

      This would look like (just to give an example of the tracking):
      var _this = this;
      ga('send', 'event', 'My category', 'My action', {
          'hitCallback': function() {
              $(_this).parents('form').first().submit();
          }
      });
       
      return !window.ga;

      Unfortunately the search results page (/search.php) doesn't include any search query parameter, so I cannot use this URL (standard implementation in analytics just requires this search query param).

      Thanks in advance for any tip :)
    • Who?'s Avatar
    • Who?
    • Preeminent Rocketeer
    • Posts: 25562
    • Thanks: 613
    • Joomla freelancer

    Re: SOLVED Form fields to match JS

    Posted 10 years 11 months ago
    • I guess it would be possible somehow, but on that kind of question only a developer could answer. You have to understand that moderators are not devs and sometimes development related questions are really too difficult to answer, especially those that asks for a custom development
    • Check my services at: Mihha-Vision

Time to create page: 0.061 seconds