unsider Posted July 16, 2008 Share Posted July 16, 2008 I'm not sure if this should be posted here, if it's incorrect please feel free to move. I'm trying to accomplish the goal of outputting the error message inside of the text box, as opposed to under it, to optimize my space. While something static is rather easy to do: <input type="text" name="s" id="s" value="Text to be displayed here" onfocus="if(this.value==this.defaultValue)this.value='';" onblur="if(this.value=='')this.value=this.defaultValue;"/> I'm not quite certain how to accomplish that with dynamic content. I'm not sure if it's the same, not possible, use of JS is necessary, etc.. Here is the form with the error output. <input type="text" name="username" maxlength="30" size="25" value="<? echo $input->setValue("username"); ?>"><? echo $input->setError("username"); ?> Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/115023-form-error-simple-solution/ Share on other sites More sharing options...
spiceydog Posted July 16, 2008 Share Posted July 16, 2008 Have you tried rebooting your computer? Quote Link to comment https://forums.phpfreaks.com/topic/115023-form-error-simple-solution/#findComment-591479 Share on other sites More sharing options...
samshel Posted July 16, 2008 Share Posted July 16, 2008 <input type="text" name="username" maxlength="30" size="25" value="<? echo $input->setValue('username').' : '.$input->setError('username'); ?>"> perhaps something like this...? Quote Link to comment https://forums.phpfreaks.com/topic/115023-form-error-simple-solution/#findComment-591480 Share on other sites More sharing options...
unsider Posted July 16, 2008 Author Share Posted July 16, 2008 <input type="text" name="username" maxlength="30" size="25" value="<? echo $input->setValue('username').' : '.$input->setError('username'); ?>"> perhaps something like this...? Unfortunately this would not work. The setValue is inputting the data from that field to be processed, and the setError is the message that is displayed if the form processing catches an error. I tested it anyway, and no good. Thanks though Have you tried rebooting your computer? Umm..you serious? Quote Link to comment https://forums.phpfreaks.com/topic/115023-form-error-simple-solution/#findComment-591490 Share on other sites More sharing options...
samshel Posted July 16, 2008 Share Posted July 16, 2008 can you post some more code? Quote Link to comment https://forums.phpfreaks.com/topic/115023-form-error-simple-solution/#findComment-591493 Share on other sites More sharing options...
unsider Posted July 16, 2008 Author Share Posted July 16, 2008 can you post some more code? Unfortunately that wouldn't help. There isn't much to it other than the setValue field inputs the data, and is then processed by my scripts, and if in the process it catches an error it would output it in the setError field, but at the moment the setError is outputting plain text underneath the form, I would like to output it inside of the text field. (If at all possible) I guess I'm reclarifying the situation, but I am sorry to be a pain and not go collect all the processing code, but I don't think it'd make a difference. Quote Link to comment https://forums.phpfreaks.com/topic/115023-form-error-simple-solution/#findComment-591494 Share on other sites More sharing options...
unsider Posted July 16, 2008 Author Share Posted July 16, 2008 Don't mean to bump so soon, but anyone have any ideas...i can't find anything on google. Quote Link to comment https://forums.phpfreaks.com/topic/115023-form-error-simple-solution/#findComment-591542 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.