Note that there are some explanatory texts on larger screens.

plurals
  1. POI want an error box to pop up, but it doesn't even tho the error does occur
    primarykey
    data
    text
    <p>i have made a webform, and i have a script for the handeling of this form (php) this script works fine, but i also made a javascript error checker, now when i try to get some php in that script, it somehow bugs, and doesn't check my errors, in javascript,</p> <p>below you will find the code i wrote for the error handeling, i'm not finished yet, but i'm currently stuck, since i need to go to my database to check something, and the javascript error handler bugs there.</p> <p>quick walktrough: I myself have 0 karma for the purposes of testing this error handling. i click submit, and even tho i haven't filled in my username, it doesn't show an error. and brings me directly to the php handler wich does find errors.</p> <pre><code>Do you like the content on our website? Do you want to be a part of it? Want to earn more Karma?&lt;br /&gt; Do you have what it takes to be a content creator? Then sign up here!&lt;br&gt; &lt;br&gt; &lt;?php function getUID() { global $user; if ($user-&gt;uid) { $userID=$user-&gt;uid; echo $userID; } else { header('Location: http://brokendiamond.org/?q=node/40'); } } function getUN() { global $user; if ($user-&gt;uid) { $username=$user-&gt;name; } echo $username; } function getKarma() { include "php-scripts/DBConnection.php"; $con = getconnection(); mysql_select_db("brokendi_BD", $con); $result = mysql_query("SELECT * FROM userpoints WHERE uid='getUID()'"); $row = mysql_fetch_array($result); $currentkarma = (int)$row['points']; echo $currentkarma; } ?&gt; &lt;script type="text/javascript"&gt; function validateForm() { var name=document.forms["CCF"]["username"].value; var karma = parseInt(&lt;?php echo json_encode(getKarma()); ?&gt;); var errors = ""; if (name==null || name=="") { errors += "Error: The username field cannot be empty"; } if (karma &lt; 500) { errors += "Error: Not enough Karma, you need at least 500 karma to submit this form"; } if (errors != "") { alert(errors); return false; } } &lt;/script&gt; &lt;form name="CCF" action="php-scripts/sendmail.php" method="post" onsubmit="return validateForm()" &gt; Username: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp &lt;input type="hidden" name="UserID" value="&lt;?php getUID() ?&gt;"&gt; &lt;input type="text" name="username" value="&lt;?php getUN() ?&gt;" /&gt;&lt;br&gt; E-mail adress: &lt;input type="text" name="mail" /&gt;&lt;br&gt;&lt;br&gt; What type of 'Content Creator' do you want to become? &lt;br /&gt; &lt;input type="radio" name="CCT" value="Blogger" /&gt; Blogger&lt;br /&gt; &lt;input type="radio" name="CCT" value="Livestreamer" /&gt; Livestreamer&lt;br&gt; &lt;br&gt; What's your motivation?&lt;br /&gt; &lt;textarea name="motivation" cols="60" rows="6"&gt;&lt;/textarea&gt;&lt;br&gt;&lt;br&gt; Why should we pick you as content creator?&lt;br /&gt; &lt;textarea name="whyshouldwe" cols="60" rows="6"&gt;&lt;/textarea&gt;&lt;br&gt;&lt;br&gt; Do you have some reference material?&lt;br /&gt; &lt;textarea name="reference" cols="60" rows="6"&gt;&lt;/textarea&gt;&lt;br&gt;&lt;br&gt; &lt;h3&gt;Rules to content creation&lt;/h3&gt; &lt;p&gt;You can only submit this once every day, the other versions will not be read, and you will lose Karma for each submit.&lt;br /&gt; When u submit this form, we will examine your account, and we will take a close look to your reference material.&lt;br&gt; &lt;h4&gt;For Livestreamers Only&lt;/h4&gt; If we think you have what it takes to be a livestreamer ( frequent hours required ) we will examine your stream, and your computer/internet potential.&lt;br /&gt; If that is good enough for the website, you'll become a content creator.&lt;br&gt; &lt;h4&gt;For Bloggers&lt;/h4&gt; If we think you are blogging material for out website, you will become a content creator, once you are accepted onto the team we will track your progress.&lt;br /&gt; If however you neglect your power or publish inappropriate content, then we will have no choice but to remove you from our team and will revert you to a regular user account.&lt;br&gt;&lt;br&gt; &lt;input name="Send" type="submit" id="art-button-wrapper" value="I donate 500 Karma, and want to become a 'Content Creator'!" /&gt; &lt;/form&gt; </code></pre> <p>I can't see what the problem is, or why it won't work because i'm not skilled enough yet in javascript.</p> <p>Thanks in advance, Jonathan</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload