Note that there are some explanatory texts on larger screens.

plurals
  1. POHTML input require attribute does not work
    primarykey
    data
    text
    <p>as said above the require attribute does not work for me , i have searched already a bit but the answers i found here and elsewhere on the web could not help me, would be great if someone could help me </p> <p>the application is nothing special , just a little thing for me to learn php and jquery, here it is : </p> <pre><code>&lt;!DOCTYPE HTML&gt; &lt;html&gt; &lt;head&gt; &lt;meta charset="utf-8"&gt; &lt;title&gt;Sig Generator&lt;/title&gt; &lt;script type="text/javascript" src ="jquery-2.0.3.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="sig.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="legalform" align ="center"&gt; Rechtsform auswählen:&lt;br&gt;&lt;br&gt; &lt;select id="selection" size="1"&gt; &lt;/select&gt;&lt;br&gt;&lt;br&gt; &lt;input id="sendLegalForm" type="button" value ="Weiter"/&gt; &lt;/div&gt; &lt;div id="fields" align="center"&gt; &lt;form id="fieldsForm" &gt; &lt;br&gt; &lt;br&gt; &lt;input id="sendFields" type="submit" value="Weiter"/&gt; &lt;/form&gt; &lt;br&gt; &lt;/div&gt; &lt;div id="display" &gt; &lt;textarea id="textarea" cols="30" rows="20"&gt;&lt;/textarea&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>the jquery</p> <pre><code>$(document).ready(function() { var $selection =""; $.ajax({ type:'GET', url:'http://localhost/php/sig.php?legalforms=true', dataType:'json', success: function (data){ $("#display").hide(); var selection = []; for(var i = 0; i&lt;data.length; i++){ selection.push('&lt;option&gt;', data[i],'&lt;/option&gt;'); } $("#selection").html(selection.join('')); $("#fields").hide(); }, error: function(jqXHR,textStatus,errorThrown){ console.log(jqXHR); console.log(textStatus); console.log(errorThrown); } }); $("#sendLegalForm").click(function () { selection = $('#selection').val(); $.ajax({ type:'GET', url:'http://localhost/php/sig.php?selectedLegalform='+ selection, dataType:'json', success: function (data){ $("#legalform").hide(); $("#fields").show(); var fieldnames =[]; for(property in data.namesToSubmit){ fieldnames.push(property); } var fields=[]; for(var i=0; i&lt;data.textfieldHeaders.length; i++){ fields.push(data.textfieldHeaders[i],'&lt;br&gt;','&lt;input name="',fieldnames[i],'" type="text"',data.namesToSubmit[fieldnames[i]] == "required"?"required":"",'&gt;','&lt;br/&gt;'); } fields.push("&lt;br&gt;", 'Pflichtfelder (*)'); $("#fieldsForm").prepend(fields.join('')); }, error: function(jqXHR,textStatus,errorThrown){ console.log(jqXHR); console.log(textStatus); console.log(errorThrown); } }); }); $("#sendFields").click(function(){ $.ajax({ type:'POST', url: 'http://localhost/php/sig.php?fieldsend='+selection, data: $("#fieldsForm").serialize(), success: function (data){ $('#fields').hide(); $('#display').show(); $("#textarea").html(data); }, error: function(jqXHR,textStatus,errorThrown){ alert('Bitte alle Pflichtfelder ausfüllen.'); console.log(jqXHR); console.log(textStatus); console.log(errorThrown); } }); return false; }); }); </code></pre> <p>and the php file</p> <pre><code>&lt;?php header('Content-type: application/json; charset=UTF8'); header('Access-Control-Allow-Origin: *'); header("Cache-Control: no-cache, must-revalidate"); header("Expires: 0"); if (isset($_GET['legalforms'])) { $legalform = array( 'Aktiengesellschaft', 'GmbH'); echo json_encode($legalform); } else if(isset($_GET['selectedLegalform'])) { $selection = $_GET['selectedLegalform']; $fieldArray = array(); if ($selection == 'GmbH'){ $fieldArray['namesToSubmit'] = array( 'companyName', 'location', 'phone', 'fax', 'web', 'registryCourt', 'registryNumber', 'ceo'); $fieldArray['textfieldHeaders'] = array('Firmenname und Rechtsform*', 'Anschrift*', 'Telefon', 'Fax', 'Webseite', 'Registergericht*', 'Registernummer*', 'Geschäftsführer*'); } if($selection =='Aktiengesellschaft'){ $fieldArray['namesToSubmit'] = array( 'companyName'=&gt;'required', 'location' =&gt;'required', 'phone'=&gt;null, 'fax'=&gt;null, 'web' =&gt; null, 'registryCourt'=&gt;'required', 'registryNumber'=&gt;'required', 'board'=&gt;'required', 'chairmanboard'=&gt;'required'); $fieldArray['textfieldHeaders'] = array('Firmenname und Rechtsform*', 'Anschrift*', 'Telefon', 'Fax', 'Webseite', 'Registergericht*', 'Registernummer*', 'Vorstand*', 'Aufsichtsratsvorstzender*'); } echo json_encode($fieldArray); } else if ($_GET['fieldsend']) { $selection = $_GET['fieldsend']; $signatur = "--\n"; foreach($_POST as $key =&gt; $value) { if($selection == 'Aktiengesellschaft'){ // do something.. } } echo json_encode($signatur); } ?&gt; </code></pre>
    singulars
    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.
 

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