Jump to content
php.lv forumi

bik no js


Genesis

Recommended Posts

Tipa doama ir tāda ka ir poga. Nedrikst laut lietotajam nospiest pogu 2x, tapec iepinu js. Doma bija tada, ka lietotajs nospiez 1x pogu, tā disablojas un izpildas nopstotā forma... nu jā.. it kā uzrakstiju, bet nestrada. :) varbut kads zin kas pie vainas?.. :)

 

JS:

<script type="text/javascript">  
function dis_button(a)
{
	document.getElementById('butt'+a).disabled=true;
	document.getElementById('form'+a).submit();
}
</script>

 

PHP:

..........kods.......
echo '<form id="form'.$counter++.'"action="edit_gallery.php?id='.$galleryID.'" method="post">';
echo'<input id="butt'.$counter.'"  type="submit" name="up" value="UP" onclick="dis_button('.$counter.')"/>
							<input type="submit" name="down" value="DOWN"/>
							<input type="submit" name="delete" value="Dzēst"/>
							</form>';

Link to comment
Share on other sites

a pec pogas diabloshanas izpildisies pogas posts? nu tipa :

 

<?php
if (isset($_POST['kkas']))
{
echo "āsd";
};
?>

 

<form id="asd" action="me.php" method="post">
<input type="submit" name="kkas" value="Nespaidi mani" onclick="this.disabled=true;this.value='Pietiks...'"/>
</form>

 

vai .. notiks echo? nenotiks tacu.. vismaz man ta liekas.. :)

Edited by Genesis
Link to comment
Share on other sites

Nezinu kas tev tur nestrādā, bet man viss strādā.

 

<form method="post" action="http://google.lv">
<p>
	<input type="submit" value="Klikšķini!" onclick="this.disabled=true;"/>
</p>
</form>

 

Edit: Strādā, bet kaut kādā jēgā pazūd pats submit lauks. Ja ir kāds cits lauks, tad tas no-post-ojas.

 

Edit2: Pieleca - ja lauks skaitās disabled, tad loģiski, ka pārlūks saprot, ka no viņa nav nekādas jēgas un viņš netiek padots post datos.

 

Edit3:

 

Šitam gan būtu jāstrādā:

<script type="text/javascript">
var submitted = false;

function submitMe(){
	if(!submitted){
		submitted = true;
		return true;
	}else{
		alert('Esi jau spiedis!');
	}
	return false;
}
</script>

<form method="post" action="http://asdsfdsf.com">
<p>
	<input type="submit" name="ok" value="Klikšķini!" onclick="return submitMe();"/>
</p>
</form>

 

Edit4: Bet vispār tev nevajadzētu pļauties uz JS, jo refresh jau tāpat varēs nospiest...

Edited by briedis
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...