[HTML] Formularz

0

Witam. Założyłem na mojej stronie usługę boksów reklamowych. I mam taką listę "Status prawny" i tam są Osoba prywatna i Firma. I chcę zrobić tak, że jak sie wybierze Firma, to tylko niektóre pola w formularzu będą aktywne, a jak Osoba prywatna, to też żeby tylko niektóre pola były aktywne. Jak to zrobić?

0

JavaScript
http://www.w3schools.com/htmldom/dom_obj_text.asp
sprawdzasz co wybrane i w elementach, które mają być nieaktywne dajesz disabled

Prosty przykład:

<style type="text/css">
input.txt {border: 1px solid black}
</style>
<script type="text/javascript">
function zmien_formularz(typ){

  if(typ == "firma"){
    document.getElementById('imie').disabled = true;
    document.getElementById('imie').style.backgroundColor='gray';
    document.getElementById('firma').disabled = false;
    document.getElementById('firma').style.backgroundColor='white';
  }
  else{
    document.getElementById('firma').disabled = true;
    document.getElementById('firma').style.backgroundColor='gray';
    document.getElementById('imie').disabled = false;
    document.getElementById('imie').style.backgroundColor='white';
  }
}
</script>
<form method="post">
<input type="radio" name="typ" value="firma" onclick="zmien_formularz(this.value);"> Firma<br />
<input type="radio" name="typ" value="osoba" onclick="zmien_formularz(this.value);"> Osoba prywatna<br />
Imie <input type="text" size="20" id="imie"  class="txt"><br />
Firma <input type="text" size="20" id="firma" class="txt"><br />
</form>
0

A jak te dane wpisane w formularzu przenieść teraz do Edit'ów w programie napisanym w Delphi?

1 użytkowników online, w tym zalogowanych: 0, gości: 1