/    Sign up×
Community /Pin to ProfileBookmark

Message border should change

I have css for message:

[code=php]

.message { width:auto;
font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px;
line-height: 16px; text-decoration: none;
background-color: #FFFFFF;border:1px solid #FF3300; padding:2px }
[/code]

How to do that it will change border automatic according to error width

Now is 100 % width – always. :rolleyes:

to post a comment
CSS

8 Comments(s)

Copy linkTweet thisAlerts:
@byeeeJan 19.2006 — How to do that it will change border automatic according to error width[/QUOTE]
What does error width mean?
Copy linkTweet thisAlerts:
@toplisekauthorJan 19.2006 — If user puts data and my form on web site shows that there is error in input, it should be error message with border as CSS. Problem is that it is not width as error. It is actually 100 % width of border. Do you know how to fix this? So border should change with text width within message.
Copy linkTweet thisAlerts:
@byeeeJan 20.2006 — I *think* I understand what you mean, but I'm not too sure about it.

You have a div, and you want it to have a different border color if there was an error.

Just make 2 classes:

.message {}

and .error {}

And set the border color and width for each of them.

In the PHP code of your page, use a simple IF:
[code=php]echo "<div ";
if ($errors_found) { echo "class="error""; }
else { echo "class = "message""; }
echo ">";[/code]

Is that what you were looking for?
Copy linkTweet thisAlerts:
@toplisekauthorJan 20.2006 — I *think* I understand what you mean, but I'm not too sure about it.

You have a div, and you want it to have a different border color if there was an error.

Just make 2 classes:

.message {}

and .error {}
[/QUOTE]

Message is in my case error. If there is no error it will redirect to another page. So, I do not need two classes. Just error (my name is for this message)
Copy linkTweet thisAlerts:
@byeeeJan 20.2006 — You could've said that from the beginning...
[code=php]/* Check for the POSTDATA and do whatever you want with it */
if (isset($_POST['whatever'])) {
/* Process data and set $error variable */
}
if ($error) {
/* Output the error and anything else needed. */
}
else {
header("Location: redirected.php");
}[/code]

Is that what you wanted?
Copy linkTweet thisAlerts:
@toplisekauthorJan 20.2006 — Again.

I do not need your code as I have already this.

Please give me what to change in [U]CLASS[/U] as border is not correct when there is message.
Copy linkTweet thisAlerts:
@byeeeJan 20.2006 — You don't want any codes... what do you want then?

I just don't understand what you want. Try to correct your posts if you want someone to help you.
Copy linkTweet thisAlerts:
@toplisekauthorJan 20.2006 — Please give me what to change in CLASS as border is not correct when there is message.
×

Success!

Help @toplisek spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...