Warning

 

Close
Confirm Action

Are you sure you wish to do this?

Cancel Confirm
AR15.COM
10/14/2014 11:52:30 AM EDT
So I'm the default tech person for my group at work because I'm not completely retarded when it comes to this stuff, but I'm nowhere near an expert on any of this, so I have a question.

Long story short, I'm wondering if it's possible to force the addition of wildcards to whatever the input from the user is from a text input, is that possible with HTML or am I looking at some scripting?
10/14/2014 12:45:46 PM EDT
[#1]
Need more details but it sounds like you'll probably need some javascript
10/14/2014 1:44:24 PM EDT
[#2]
I'm looking to append the p_search string with * at the front and back, which I'm thinking can't be done with simple HTML thus be way out of my league to create.
<form class=1st id=naics name=naics method="get" action="http://www.osha.gov/pls/imis/sicsearch.html" target="iframe">

<input type=text name="p_search" size="20">
<input class=button type=submit value="Keyword Search"></p>
10/14/2014 4:19:36 PM EDT
[#3]
This works I hacked up this source: http://jsfiddle.net/8e9ku79p/

<html>
<head>
<script type='text/javascript'>
window.onload=function(){
   var processForm = function () {
       var value = document.getElementById('p_search').value;
       var html = '*' + value + '*';

       document.getElementById('p_search').value = html;
   };

   document.getElementById('submit').addEventListener('click', function () {
       processForm();
   }, false);
}
</script>
</head>
<body>
 <form name="naics" action="http://www.osha.gov/pls/imis/sicsearch.html" method="get">Input:
   <input id="p_search" type="text" name="p_search" value="">
   <input class="btn" type="submit" value="Submit" id="submit">
</form>
</body>
</html>