Hi everyone,
I have the following code block where an input field is being validated and a span with an error message appears if the validation fails:
<div>
<label for="email">Email:</label>
<input id="email" name="email" type="text" value="Email address" onfocus="if (this.value == 'Email address') this.value=''" onblur="if (this.value == '') this.value='Email address'" />
<?php
if (ValidatedField('index_965','index_965')) {
if ((strpos((",".ValidatedField("index_965","index_965").","), "," . "3" . ",") !== false || "3" == "")) {
if (!(false)) {
?>
<span style="color: red; margin: 0; padding: 0;"> Email is required </span>
<?php //WAFV_Conditional index.php index_965(3:)
}
}
}?>
</div>
It all works well and I have the following css rule in an external css file that sets a margin-bottom for the input field:
div#news input {
width: 135px;
height: 15px;
margin-bottom: 10px;
padding-left: 5px;
font-size: 11px;
}
This margin is ok if the validation passes and the spans don't appear, but if validation fails and they do appear then I need the margin to be taken off the input field and applied instead to the span so that there's now space after the span instead of before it.
I wondered if anyone could tell me how to revise the php code above so I can get this to work? I'm assuming the code would need to go above the following line:
<span style="color: red; margin: 0; padding: 0;"> Email is required </span>
But I don't know how to target the input field since it appears above the span.
Appreciate any advice.