send css information of the input field

Is it possible to send the css information of the input field when the form is submitted?
Who is Participating?
Slick812Connect With a Mentor Commented:
Good deal, but I hope you can read that Input from database storage and then change all CSS in the new (next) form as PHP page output, you may can just write all the <input> -
Class="bold red"
as needed, but you can also redo the javescript calls to redo the CSS standings.
Ray PaseurCommented:
Yes, but it takes a lot of forethought.  This is a very unusual request.  Can you please explain why (in non-technical business terms) you would want to do this?  What problem does it solve?
myyisAuthor Commented:
I am manipulating the css structure of the form with js and want to keep the new css info on database
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Ray PaseurConnect With a Mentor Commented:
OK, I don't think that's a non-technical business explanation, but I can understand the idea, I think.  

You're using classes to add and remove the CSS characteristics, right?  

You should be able to add the class name to more than one element.  When you add it as a class on the name of one visual element, you could also add it as a value on a hidden form control, and simultaneously make an AJAX call to the background script that would update the data base.

Though it is potentially much more complex, you should also be able to read the important CSS characteristics of an element (there are a lot of characteristics) and put these into an array.  Then you might create a JSON string from the array and pass that to the AJAX call.  Like the class name, the JSON string could be stored in the data base.

It's an interesting research project, but I see nothing standing in the way of proving the theory.  If you're new to jQuery and AJAX requests, this article may help you get started.
myyisAuthor Commented:
Thank you very much.

I think I will go with the 2nd alternative.
Can you explain the below more? An example would be great!

"Though it is potentially much more complex, you should also be able to read the important CSS characteristics of an element (there are a lot of characteristics) and put these into an array. "
Ray PaseurCommented:
It's a research project for me, just as it would be for you.  If I have time today or tomorrow I'll try to show you a basic framework for this.  Start with a good understanding of these references:

Your first jQuery script might try to get something simple like the class name or the width of an element.  You can use JavaScript alert() to prove that you've accessed the right information.
myyisAuthor Commented:
I will try thank you.
greetings myyis, , There may or may not be a straight-forward way to do this in javascript and change the "Form" inputs to send the current Class and CSS settings for any particular <input>,  OR for ALL of the <input>, , it will depend on how complex the "changes" are and how you "Restructure" the next output Form with CSS from a database Read of the previous CSS settings. It would help me if you can show the form HTML and maybe some part of the CSS structuring that it has, and then tell about the CSS that needs to be in the Next Form settings.
myyisAuthor Commented:
Hi all,
I think I will follow this way, seems to me easy,
Just before submitting the form, I will loop over all the inputs and read  the necessary css info with js and write to a specific input tag.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.