1 reply [Last post]
jPaulB
jPaulB's picture
Offline
newbie
Moncton, NB
Last seen: 24 weeks 1 day ago
Moncton, NB
Timezone: GMT-4
Joined: 2013-07-11
Posts: 4
Points: 7

Hi Everybody,

I have an issue but I can not figure out what the "name" to attach to a CSS action.

I have an eMail kind of form, with just three inputs:
a "textarea" for comments
input type="text" for the visitors' name
input type="email" for the vistors' eMail address
They are all bound by the class "form-control".

What I want to do is:

  • Have the first input (textarea) to automatically be in focus rather than require a visitor to select one of the inputs.

  • Once a visitor has entered a response to each of the inputs, I would like to change the background-color, and perhaps seal the input against modifications..

That's it! How do I make these changes to the css file?

Many Thanks,
Paul

thepineapplehead
thepineapplehead's picture
Offline
Moderator
Last seen: 3 weeks 5 days ago
Timezone: GMT+1
Joined: 2004-06-30
Posts: 9683
Points: 819

Hi Paul, what you're after

Hi Paul, what you're after can't really be done just by CSS I don't think.

Autofocus is what you need for your first query https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus

For your second query, how are you going to define when the user is finished and "lock" the field? You can apply the readonly attribute https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/readonly but what happens if the user accidentally tabs out of a field, or makes a mistake? What is the reason for stopping them amending the fields before submitting the form?

Verschwindende wrote:
  • CSS doesn't make pies