StefanoM2
-
Posts
4 -
Joined
-
Last visited
Content Type
Forums
Gallery
Blogs
Events
Store
Downloads
Profiles
Posts posted by StefanoM2
-
-
Hi to all! I'm trying to set a value in a contact form field, but I'm having troubles.
In facts, it seems that I can set the value, with this instruction:
$('#text-1066fdb2-1602-44d4-9cdb-69681a16189a-field').val("ok").change();
I see the value in the textbox changing, but when I press the button to send the form, the value disappear. It seems that I'm not changing the real field, but a sort of link of it.Â
How can I really set the value of the field? Is it possible?
thanks a lot
Stefano.
Set Contact Form field value from javascript
in Customize with code
Posted
Thank you for your prompt reply ... I tried the code, everything seems correct, via "console.log" I see correct values, the field doesn't change until a "human" enter value manually in the field.
I think I understood the example of codepen:
https://codepen.io/anulesh91/pen/XGwZoR
and it works, but in squarespace form it doesn't. Any ideas?
At least, what I'm trying to do is simply trap 2 additional controls in a form, for example: range of dates, range of hours. I'm not able to "prevent" the form submission in any way (button is not "prevantable"), so I was trying to have a hidden field mandatory, to fill with a value only when my custom controls are ok. That's quite simple, but squarespace doesn't permit me to customify almost nothing 😞
If you have any ideas and / or advices i would appreciate very much.
Â
thanks
Stefano.
Â
Â