dc_jt Posted October 17, 2006 Share Posted October 17, 2006 HiI have an input form which displays errors if one or more fields are not completed. E.g. Please enter name.However, these appear above the input form which then moves the input form further down the page and out of place. Is there anyway, once the form is submitted, the error messages are shown inside the input form (well inside the outline of it) replacing the input values name, email etc, with a button to go back which then displays the input form with the missing input?If you understood that, any help would be great thanks Quote Link to comment Share on other sites More sharing options...
craygo Posted October 17, 2006 Share Posted October 17, 2006 post your code so we can take a look.Ray Quote Link to comment Share on other sites More sharing options...
dc_jt Posted October 17, 2006 Author Share Posted October 17, 2006 I cant for some reason it says URL could not be retrieved?? Quote Link to comment Share on other sites More sharing options...
craygo Posted October 17, 2006 Share Posted October 17, 2006 open your page for editing and copy and paste the code here.Ray Quote Link to comment Share on other sites More sharing options...
dc_jt Posted October 17, 2006 Author Share Posted October 17, 2006 I did do that and when i click post it says:The requested URL could not be retrievedWhile trying to retrieve the URL: http://www.phpfreaks.com/forums/index.php?The following error was encountered: * Read Error The system returned: (104) Connection reset by peerAn error condition occurred while reading data from the network. Please retry your request.Your cache administrator is root. Quote Link to comment Share on other sites More sharing options...
craygo Posted October 17, 2006 Share Posted October 17, 2006 did you put it between the "code" tagsRay Quote Link to comment Share on other sites More sharing options...
dc_jt Posted October 17, 2006 Author Share Posted October 17, 2006 yes ??? Quote Link to comment Share on other sites More sharing options...
craygo Posted October 17, 2006 Share Posted October 17, 2006 I think there are sites out there that will host a script for others to view. You can try those. I have had the same problem in the past and it was a certain part of my code that the site did not like. Maybe you can break it up and post it that way till you come across the part that will not work.Ray Quote Link to comment Share on other sites More sharing options...
dc_jt Posted October 17, 2006 Author Share Posted October 17, 2006 Well I dont actually have an error. When I say error messages, they are there on purpose because the user has not entered all their details correctly. For example, if they entered nothing it would say:# Please enter your Name# Please enter a valid Email address# Please enter your Address# Please enter your Business Name# Please enter your Type of BusinessHowever, this is displayed directly above the input form.Instead I want it to be displayed INSIDE the form, replacing the Name, Email, Address etc fields and then having a back button which then brings these fields back for the user to input correctly??Do you understand? Sorry its confusing, but is this possible?Thanks Quote Link to comment Share on other sites More sharing options...
craygo Posted October 17, 2006 Share Posted October 17, 2006 i cannot help if I do not see the code you are using. We need the actual code.Ray Quote Link to comment Share on other sites More sharing options...
dc_jt Posted October 17, 2006 Author Share Posted October 17, 2006 This is the form in the index file[code] <form name="myform" method="post" action="<?=$_SERVER['PHP_SELF']?>"> <div class="home_text"> <?php if ($sMode == 'complete') { echo '<div class="complete">Thank You for submitting your details.</div>'; } else { ?> <? if(is_array($aErrors) && count($aErrors) > 0) { ?> <ul> <? foreach($aErrors as $sError) { echo '<li>'.$sError.'<br></li>'; } // end foreach ?></ul><? } //end if (is_array($aErrors)... ?> <div class="formwrapper"> <div class="textlabel">Name</div><div class="formlabel"> <input name="Name" type="text" class="dataform" value="<?=(stripslashes($_POST['Name']))?>" /> </div> <div class="textlabel">Email</div> <div class="formlabel"> <input name="Email" type="text" class="dataform" value="<?=(stripslashes($_POST['Email']))?>"/> </div> <div class="textlabel">Address</div> <div class="formlabel"> <textarea name="Address" rows="2" wrap="virtual" class="dataform"><?=(stripslashes($_POST['Address']))?></textarea> </div> <div class="textlabel">Business Name </div> <div class="formlabel"> <input name="Business_Name" type="text" class="dataform" value="<?=(stripslashes($_POST['Business_Name']))?>"/> </div> <div class="textlabel">Type of Business </div> <div class="formlabel"> <input name="Type_of_Business" type="text" class="dataform" value="<?=(stripslashes($_POST['Type_of_Business']))?>"/> </div> <div class="textlabel">Comments</div> <div class="formlabel"> <textarea name="Comments" rows="2" wrap="virtual" class="dataform"><?=(stripslashes($_POST['Comments']))?></textarea> </div> <div class="textlabel"> </div><div class="formlabel"> <input name="Submit" type="submit" class="databut" value="Submit" /> <input type="hidden" name="mode" value="apply" /> <br class="clear"/> </form>[/code]This is the RCLTblClients class[code]private function ValidateClientData($aPostData) { $aErrors = array(); if(!$aPostData['Name']) { $aErrors['Name']='Please enter your Name'; } if(validateemail($aPostData['Email'])===false) { $aErrors['Email']='Please enter a valid Email address';} //if(validateemail(!$aPostData['Email'])===false) //{ // $aErrors['Email']='Please enter your Email'; //} if(!$aPostData['Address']) { $aErrors['Enquiry']='Please enter your Address'; } if(!$aPostData['Business_Name']) { $aErrors['Business_Name']='Please enter your Business Name'; } if(!$aPostData['Type_of_Business']) { $aErrors['Type_of_Business']='Please enter your Type of Business'; } if (count($aErrors) > 0) return array(false, $aErrors); return array(true); }}[/code]Is that enough for you? (*Hope this works*) Quote Link to comment Share on other sites More sharing options...
dc_jt Posted October 17, 2006 Author Share Posted October 17, 2006 Any idea Ray or anyone else?Thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.