Thursday, 15 July 2010

php - Is it possible to refresh an html input onChange of a selectbox? -


I have a search format with a select radius, I search on postcalls using an online API. If typed the API auto submits, but after depositing it and I change the radius, I have to type in the postal code again, otherwise the new data is not sent.

I want to know what

my search form:

  & lt; It is possible to refresh the input for the form name = "input" method = "post" action. = "Search result" category = "pro 6pp_order" & gt; & Lt; Input type = "search" onchange = "validate ()" placeholder = "zocaine ..." name = "search" size = "85" & gt; & Lt; Input type = "search" name = "searchpc" required = "required" class = "postcode" value = '& lt ;? = $ Postcode? & Gt; ' Placeholder = "Postcode (1234)" Maximum Length = "4" & gt; & Lt; Id = "selection" category = "category" onchange = "updateInput (this.value)" & gt; & Lt; Option value = "5" & gt; 5km & lt; / Options & gt; & Lt; Option value = "10" & gt; 10km & lt; / Options & gt; & Lt; Option value = "15" & gt; 15 km & lt; / Options & gt; & Lt; Option value = "20" & gt; 20km & lt; / Options & gt; & Lt; Option value = "50" & gt; 50km. & Lt; / Options & gt; & Lt; / Select & gt; & Lt; Input type = "submit" value = "zocaine" & gt; & Lt; Br / & gt; & Lt; Span class = "message" & gt; & Lt; / Span & gt; & Lt; Period class = "output" & gt; & Lt; / Span & gt; & Lt; Br / & gt; & Lt; / Form & gt; I tried to do this, but it does not work:  
  function update input (search) {document.getElementByName ("searchpc"). Value = & lt; ? Php $ postcode echo? & Gt ;; }   

Also note the on-change function on my selection box.

It may work

  function update input ( SearchCc) {document.getElementByName ("searchpc") Value = searchpc; }   

searchpc is "this.value" of your selection tag.

Please tell me whether it is working or not.

UPDATE

If you type 9101 and then if you select 10km then you < Post a form like pre> function updateInput (Searchpc) {document.input.submit (); }

So we will find both 9 9101 and 10km in the search results page.

New update

I think your small box input form should be as follows.

  & lt; Form name = "small_input" action = "searchresults" method = "post" & gt; & Lt; Input type = "text" placeholder = "postcode" size = "25" name = "postcode" /> & Lt; Choose name = "radius" class = "category" onchange = "updateInput (this.value)" & gt; & Lt; Option selected = "" disabled = "" & gt; Afstand & lt; / Options & gt; & Lt; Option value = "5" & gt; 5 & ​​lt; / Options & gt; & Lt; Option value = "10" & gt; 10 & lt; / Options & gt; & Lt; Option value = "15" & gt; 15 & lt; / Options & gt; & Lt; Option value = "20" & gt; 20 & lt; / Options & gt; & Lt; Option value = "25" & gt; 25 & lt; / Options & gt; & Lt; / Select & gt; & Lt; Br> & Lt; Br> & Lt; Hour & gt; & Lt; Br> & Lt; P style = "float: correct" & gt; Input type = "submit" value = "opson" & gt; & Lt; / P & gt; & Lt; Input type = "hidden" value = "true" name = "submit" & gt; & Lt; Input type = "hidden" value = "true" name = "ft" & gt; & Lt; / Form & gt;   

Please tell me what the situation is.

No comments:

Post a Comment