/    Sign up×
Community /Pin to ProfileBookmark

please help!! send form validate and send

i need to make a page

1)where user can click yes or no.. then after all the info is gathered

2)it should be able to validate if its correct or not..

3)and send its result by e mail after its done.

please help me out..
thank you

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@steelersfan88Oct 09.2004 — 1) What is the yes and no for?

2) Do this on server side

3) See #2
Copy linkTweet thisAlerts:
@Warren86Oct 09.2004 — cctech181:

This should get you started.

<html>

<head>

<title>Test</title>

<script type="text/javascript">

function songsChosen(){

var es = choosesongs_form.elements;

var l = '';

for(var i = 0; i < es.length; i++){

if(es[i].tagName.toLowerCase() == 'input' && es[i].type.toLowerCase() == 'checkbox' && es[i].checked){

l += '<'+'li>'+es[i].value+'</li>';

}

}

choosesongs.style.display = 'none';

viewsongs.style.display = '';

viewsongs_list.innerHTML = l;

}



function backToOptions(){

viewsongs.style.display = 'none';

choosesongs.style.display = '';

}



function sendMail(){



recipient = "[email protected]"

isSubject = "Selected Songs"

isBody = viewsongs_list.innerText;

isBody = isBody.replace(/r/g,' - ')

document.forms.Send.action = "mailto:"+recipient+"?subject="+isSubject+"&body="+isBody+"&nbsp"

}



</script>

</head>

<body>



<div id="choosesongs">

<h1>Choose songs</h1>

<p>Choose the songs you want:</p>



<form id="choosesongs_form" action="" method="post" onsubmit="songsChosen(); return false;">

<p>

<input type="checkbox" value="Song name 1"> Song name 1<br>

<input type="checkbox" value="Song name 2"> Song name 2<br>

<input type="checkbox" value="Song name 3"> Song name 3

</p>

<p><input type="submit" value="Submit songs"></p>

</form>

</div>



<div id="viewsongs" style="display: none;">

<h1>You chose these songs</h1>

<p>

<input type="button" value="Print page" onclick="window.print();">

<input type="button" value="Back to options" onclick="backToOptions();">

<form name='Send'action=''>

<input type="submit" value="Send Selections by Email" onclick="sendMail()">

</form>

</p>



<ul id="viewsongs_list">

<li></li>

</ul>

</div>

</body>

</html>
Copy linkTweet thisAlerts:
@steelersfan88Oct 09.2004 — Can you please tell me how that is of any help ... ?
×

Success!

Help @cctech181 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...