Jump to content

Form Error.. ( Simple solution? )


unsider

Recommended Posts

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.

 

Link to comment
Share on other sites


<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?

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.