butony formularza 4363 5

O temacie

Autor

Zaczęty 10.05.2012 roku

Wyświetleń 4363

Odpowiedzi 5

kazzmir
  • Gość

kazzmir
Gość

butony formularza
2012-05-10, 19:22(Ostatnia zmiana: 2012-05-10, 19:23)
jak pod taki element podpiąć wysyłanie maila z formularza na podany adres.

"<div><a href="#" class="submit">Wyślij</a></div>"

ten buton działa ale wygląda jak pół dupy zza krzaka pomimo css
<input type="submit" name="Submit" value="wyślij" class="submit"

[attachment=925:Untitled-1d.jpg]
 

inż. Avallach

inż. Avallach

Administrator
posty7662
Propsy5238
NagrodyV
ProfesjaProgramista
  • Administrator
<html>
<head>
<script type="text/javascript">
function formSubmit()
{
document.getElementById("frm1").submit();
}
</script>
</head>
<body>

<p>Enter some text in the fields below, then press the "Submit form" button to submit the form.</p>

<form id="frm1" action="form_action.asp">
First name: <input type="text" name="fname" /><br />
Last name: <input type="text" name="lname" /><br /><br />
<div onclick="formSubmit()">Wyślij</div>
</form>

</body>
</html>
Na podstawie instrukcji z w3cschools. Generalnie input:submit to tylko najprostszy sposób na wykonanie funkcji submit formularza. Zawsze możesz zrobić to własną funkcją javascriptu, a ją z kolei wywołać dzięki onclick jak jest powyżej.

kazzmir
  • Gość

kazzmir
Gość

butony formularza
#2 2012-05-10, 20:43(Ostatnia zmiana: 2012-05-10, 20:47)
usz ty, to inaczej :D  mam coś takiego:

<form id="form-contact" action="" method="post" >
<div class="fixed">
<div class="sixcol pattern">
<div class="large-field">
<label for="name" >Your name:</label>
<input tabindex="1" id="name" type="text" value="" name="name" />
</div>

<div class="large-field">
<label for="organisation">Organisation:</label>
<input tabindex="3"  id="organisation" type="text" value="" name="organisation" />
</div>
</div>
<div class="sixcol last">
<div class="large-field">
<label for="email" >Your email:</label>
<input tabindex="2"  id="email" type="text" value="" name="email" />
</div>

<div class="large-field">
<label for="phone">Your phone:</label>
<input tabindex="4" id="phone" type="text" value="" name="phone" />
</div>
</div>
</div>

<div class="large-textarea">
<label for="message">Your message:</label>
<textarea tabindex="5"  rows="15" cols="25" id="message" name="message"></textarea>
</div>

<div class="notice confirmation">
<p>Your message has been sent sucessfully!</p>
<span></span>
</div>

<div><a href="#" class="submit">Send</a></div>
</form>

buton jest OK, formularz jest piękny i tak dalej, ale nie wiem jak ustawić wysyłanie pod wskazany mail wiadomość, postanowiłem połączyć jeden formularz z drugim który mam i wszystko działa OK, tylko buton wygląda źle. zauważyłem że nie ma tam pod action skierowania do pliku php który dobrze działa na tym drugim formularzu.
 

inż. Avallach

inż. Avallach

Administrator
posty7662
Propsy5238
NagrodyV
ProfesjaProgramista
  • Administrator

inż. Avallach
Administrator

butony formularza
#3 2012-05-10, 20:53(Ostatnia zmiana: 2012-05-10, 20:56)
Pokaż oba te formularze :D  
Jak nowy formularz nie działa ze starym plikiem php, to może ma ustawione inne id pól?

Albo inaczej - to co powyżej dałeś jest dobrze i chcesz tylko mieć ładniejszy przycisk wysyłania? No to tak jak napisałem wyżej:
<html>
<head>
<script type="text/javascript">
function formSubmit()
{
document.getElementById("form-contact").submit();
}
</script>
</head>
<body>
        <form id="form-contact" action="" method="post" >
        <div class="fixed">
        <div class="sixcol pattern">
        <div class="large-field">
        <label for="name" >Your name:</label>
        <input tabindex="1" id="name" type="text" value="" name="name" />
        </div>
                               
        <div class="large-field">
        <label for="organisation">Organisation:</label>
        <input tabindex="3"  id="organisation" type="text" value="" name="organisation" />
        </div>
        </div>
        <div class="sixcol last">
        <div class="large-field">
        <label for="email" >Your email:</label>
        <input tabindex="2"  id="email" type="text" value="" name="email" />
        </div>
                                       
        <div class="large-field">
        <label for="phone">Your phone:</label>
        <input tabindex="4" id="phone" type="text" value="" name="phone" />
        </div>
        </div>
        </div>
               
        <div class="large-textarea">
        <label for="message">Your message:</label>
        <textarea tabindex="5"  rows="15" cols="25" id="message" name="message"></textarea>
        </div>
                                       
        <div class="notice confirmation">
        <p>Your message has been sent sucessfully!</p>
        <span></span>
        </div>
                       
        <div><a href="#" onclick="formSubmit()">Send</a></div>
        </form>
</body>
</html>

kazzmir
  • Gość
   <form method="post" action="contactengine.php">
     <label for="Name2">Name:</label>
     <input type="text" name="Name" id="Name2" />
     <label for="City">City:</label>
     <input type="text" name="City" id="City" />
     <label for="Email">Email:</label>
     <input type="text" name="Email" id="Email" />
     <label for="Message">Message:</label>
     <br />
     <textarea name="Message" rows="20" cols="20" id="Message"></textarea>
     <input type="submit" name="submit" value="Submit" class="submit-button" />
       </form>
 

inż. Avallach

inż. Avallach

Administrator
posty7662
Propsy5238
NagrodyV
ProfesjaProgramista
  • Administrator

inż. Avallach
Administrator

butony formularza
#5 2012-05-10, 21:04(Ostatnia zmiana: 2012-05-10, 21:15)
<html>
<head>
<script type="text/javascript">
function formSubmit()
{
document.getElementById("form-contact").submit();
}
</script>
</head>
<body>
<form id="form-contact" method="post" action="contactengine.php">
<label for="Name2">Name:</label>
<input type="text" name="Name" id="Name2" />
<label for="City">City:</label>
<input type="text" name="City" id="City" />
<label for="Email">Email:</label>
<input type="text" name="Email" id="Email" />
<label for="Message">Message:</label>
<br />
<textarea name="Message" rows="20" cols="20" id="Message"></textarea>
<div><a href="#" onclick="formSubmit()" class="submit">Send</a></div>
</form>
</body>
</html>


0 użytkowników i 1 Gość przegląda ten wątek.
0 użytkowników
Do góry