Tuesday, 15 April 2014

javascript - How to change input Value without changing the input content -


I am updating the validation process of a custom form class that we will be user friendly by using masks on our form Are created for Input.

We will have to save the form via HTTP request due to file upload.

There are situations where we can use AJAX to save a form, and we created a method in those circumstances which modify the content based on that legal type, such as:

01/02/1234 to 1234-02-01 123.45678 has been changed to 123456.78

The problem occurs when I have to send it via HTTP request

Example of:

  & lt; Form id = "formID" action = "UrlToCRUDClass" onsubmit = "return validateForm (this);" & gt; & Lt; Input id = "datefind" type = "text" value = "" data-valid = "DATE" & gt; & Lt; / Form & gt;  

I want to know how to change the value sent through POST without changing the value of the input which is visible to the end-user.

| 08/04/1992 | & Lt; = User input value (input is visible inside container). 1992-04-08 | & Lt; = Post value (invisible to user input)

I tried to change with success:

  $ ('# datefield'). Attr ('value' 'unmaskedvalue'); // - Post Value is 08/04/1992 $ ('# field'). Val ('unmaskedview'); // - Change the visible content for end-user $ ('# fieldfield') Prop ('value', 'unmaskedview'). Ether ('value', 'mask'); // - changes the content visible to the end user  

to format the input within the input format and without redirecting the value within the input container, without any other The way?

I was able to thank my Ajax upload:


No comments:

Post a Comment