I need a code so I can place a date on this infusion form so I can track the day they submit it.. I think there is an onClick code I found but it did not work.
<form class="infusion-form" action="https://xxxx.infusionsoft.com" method="post">
<input name="DATE" type="hidden" value="">
<p>*First Name:</p>
<input id="inf_field_FirstName" class="default-input" name="inf_field_FirstName" type="text" />
<p>*Last Name:</p>
<input id="inf_field_LastName" class="default-input" name="inf_field_LastName" type="text" />
<p>*Email Address:</p>
<input id="inf_field_Email" class="default-input" name="inf_field_Email" type="text" />
<p>*Primary Phone No:</p>
<input id="inf_field_Phone1" class="default-input" name="inf_field_Phone1" type="text" />
<p>*Address:</p>
<input id="inf_field_Address2Street1" class="default-input" name="inf_field_Address2Street1" type="text" />
<p>*City:</p>
<input id="inf_field_City2" class="default-input" name="inf_field_City2" type="text" />
<p>*State:</p>
<input id="inf_field_State2" class="default-input" name="inf_field_State2" type="text" />
<input id="Submit" class="btn button inf-button" name="Submit" type="submit" value="Submit" />
</form>
Thanks
Here is a simple method to achieve what you've asked for. The date format is edited to toISOString as suggested by Bakudan in the comments above.
Also mentioned in the comments it is better to set the time of the submission on the server, this way you can make sure the time on the computer is current and avoid a user falsifying the time.
window.onload = function(){
var dateStr = new Date().toISOString();
var dateInput = document.getElementById('submissionDate');
dateInput.value=dateStr;
}
<input id="submissionDate" type="hidden" name="submissionDate" value="">
Related
I have two forms. form1's field data is sending to form2. form2 have 1 set 3 inline inputboxs and 1 reset button.when i clicked the reset button form1's go back to default state with out refresh the page.how can I do that?
**form1 **
<form id="formDrink" onclick="submit1(this.drinkname,this.drinkprice,this.drinkquantity)" >
<input type="text" id="drinkname" name="drinkname" value="{{$drink->product_name}}">
<input type="hidden" id="drinkquantity" value="0" >
<input type="text" id="drinkprice" name="drinkprice" value="{{$drink->selling_bottle}}">
</form>
form2
<form class="form-inline" id="kot">
<input type="text" id="drinkName" name="drinkname" value="" readonly="">
<input type="text" id="drinkQuantity" name="drinkquantity" value="" readonly="">
<input type="text" id="drinkPrice" name="drinkprice" value="" readonly="">
<input type="button" id="resetForm" onclick="drinkRemover()" value="reset" />
</form>
javascript
function drinkRemover(){
$("#formDrink")[0].reset();
}
I dont know why my javascript do not work.I tryed every posible ways but i cant reset the form1's fields to its default values.
This is what the reset input type is for:
<form class="form-inline" id="kot">
<input type="text" id="drinkName" name="drinkname" value="drinkname">
<input type="text" id="drinkQuantity" name="drinkquantity" value="drinkquantity">
<input type="text" id="drinkPrice" name="drinkprice" value="drinkprice">
<input type="reset" id="resetForm" value="reset" />
</form>
Below is the code of the form using which I'm trying to fetch the value for the query string.
<form id="form1">
<label for="allthesewords"> all these words</label>
<input type="text" id="allthesewords">
<br>
<label for="thisexactwordphrase">this exact word phrase</label>
<input type="text" id="thisexactwordphrase">
<br>
<label for="anyofthese">any of these</label>
<input type="text" id="anyofthese">
<br>
<label for="noneofthese">none of these</label>
<input type="text" id="noneofthese">
<br>
<input type="submit" value="Advance Search" onClick="advanceSearch()">
</form>
This one is the javascript function where I'm building my query string.
function advanceSearch(){
document.getElementById("form1").action="https://www.google.com/search?as_q="+document.getElementById("allthesewords").value+"&as_epq="+document.getElementById("thisexactwordphrase").value+"&as_oq="+document.getElementById("anyofthese").value+"&as_eq="+document.getElementById("noneofthese").value;
return true;
}
So, the actual problem is while clicking on the submit button it must redirect to this url
https://www.google.com/search?as_q=Harvard%20univeristy%20students&as_epq=students%20of%20Harvard%20Univeristy&as_oq=Harvard&as_eq=almamater
However, when I run my code it just redirects to this url:
https://www.google.com/webhp.
Thanks in advance!!!!!
<form action="https://www.google.com/search">
<p>Find page with</p>
<input class="input_bar" type="text" name="as_q" placeholder="all these words">
<input class="input_bar" type="text" name="as_epq" placeholder="this exact word or phrase">
<input class="input_bar" type="text" name="as_oq" placeholder="any of these words">
<input class="input_bar" type="text" name="as_eq" placeholder="none of these words">
<input id="btn" type="submit" value="Advance Search">
</form>
Use it!
I have this form where I am getting the full state Value (input type="hidden" id="state_code" name="state_code" value="Pennsylvania") , but when I need to submit the form, I need to update the full state value with state code.
For example if the state value is "Pennsylvania", then I need to update that with "PA".
The state value is dynamic so it could be any state and I need to update it accordingly. How can I do that?
Here is my form:
<form
class="needs-validation"
action=""
id="lead-form"
method="POST"
novalidate=""
>
<div class="input-group">
<input
type="email"
id="email"
class="form-control"
size="20"
maxlength="80"
placeholder="Enter your email"
required=""
/>
</div>
<input type="hidden" name="Status" value="New" />
<input type="hidden" name="Brand__c" value="" />
<input type="hidden" name="lead_source" value="Web Lead Gen Form" />
<input type="hidden" name="Market_ID__c" value="CPG" />
<input type="hidden" name="MS_ID__c" value="6" />
<input type="hidden" id="state_code" name="state_code" value="Pennsylvania" />
<input type="hidden" name="zip" value="15001" />
<input type="hidden" name="country_code" value="US" />
<input type="submit" name="Submit" class="button-orange" />
</form>
If I understood correctly, you need to addEventListener to input that you want listen to.
HTML:
<input type="text" name="Thing" value="" />
Script:
/* event listener */
document.getElementsByName("Thing")[0].addEventListener('change', doThing);
/* function */
function doThing(){
alert('Horray! Someone wrote "' + this.value + '"!');
}
You need also to initialize some variable, which you will update based on your input. Also if you need to shorten states, you need to make some kind of vocabulary function that will convert to your desired output.
How do i add some form of JQuery solution to the below code so that users are using the redirect but instead have a nice response back saying 'Thanks for subscribing'?
Also, is this the best way - The JQuery solution? Or should i try JS
<form method="post" class="af-form-wrapper" action="http://www.aweber.com/scripts/addlead.pl" >
<div style="display: none;">
<input type="hidden" name="meta_web_form_id" value="1337" />
<input type="hidden" name="meta_split_id" value="" />
<input type="hidden" name="listname" value="blah" />
<input type="hidden" name="redirect" value="http://www.aweber.com/thankyou-coi.htm?m=text" id="1237" />
<input type="hidden" name="meta_adtracking" value="blah" />
<input type="hidden" name="meta_message" value="1" />
<input type="hidden" name="meta_required" value="name,email" />
<input type="hidden" name="meta_tooltip" value="" />
</div>
<input type="text" name="name" autocomplete="off" required placeholder="First name">
<input type="text" type="email" name="email" required placeholder="Your Email">
<input type="submit" name="submit" value="Subscribe">
</form>
Edit - But have it be presentable, i.e. I want to put the text within a DIV, not Alert the user with a pop up or redirect them to my page.
$("form").submit(function(){
alert("Thanks for subscribing");
});
edit ##
Stack overflow jQueryUI Modal confirmation dialog on form submission
I have html which is something like, not exactly like this, but just to give you an idea.
<input type="text" disabled="disabled" name="ip" />
<input type="text" name="name" />
<input type="text" name="email" />
<input type="submit" value="send" />
the IP field is disabled, I want to put a button right next to it, which will enable the field without refreshing the page.
Can you please help me do this?
Thanks in advance
<input type="text" disabled="disabled" name="ip" id='ip' />
<input type="button" name="control" id="control" />
<input type="text" name="name" />
<input type="text" name="email" />
<input type="submit" value="send" />
Now put jquery code at end of file
$( "#control" ).click(function() {
$('#ip').toggleDisabled();
});
try this one:
<input type="text" disabled="disabled" name="ip" id="ip" />
<input type="button" value="Refresh" onclick="$('#ip').attr('disabled',false);">
<input type="text" name="name" />
<input type="text" name="email" />
<input type="submit" value="send" />
Give ID for your textbox.
<input type="text" disabled="disabled" name="ip" id="YourID"/>
And in jquery :
$(document).ready(function(){
$('#YourButtonID').click(function(){
if($('#YourID').prop('disabled'))
$('#YourID').prop('disabled', false)
else
$('#YourID').prop('disabled', true)
//Do nothing if not required.
});
})
Consider your buttons as shown below:
<input type="text" disabled="disabled" name="ip" /> <input type="button" id="myButton" />
Now, on clicking button right next to it you have to remove the disabled attribute of ip button in jquery as:
$("#myButton").click(function(){
$("input[name='ip']").removeAttr('disabled');
});
That's it..!!
You can use attr("disabled",false) to remove disabled attribute
Demo
you can try this:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
function enable(){
$('#ip').prop("disabled",false);
}
</script>
<input type="text" disabled="disabled" name="ip" id="ip" />
<input type="button" value="Refresh" onclick="enable();">
Check this javascript for a working example and a possible solution using javascript.
Check this jQuery 1.6+ using jQuery 1.6+.
If you want to use jQuery 1.5-, just change prop by attr.
Hope it useful!