I Have a simple html/php form on my page and i was wondering how can i add a prefix to one of the fields?
Example: if a field acts as email field, i need to have a grey prefix like "example#example.com" and dissapear when i write the email.
Is it possible?
My Form
The field i need prefix on:
<div class="form-field">
<div class="form-field-name"><b>Facebook profile</b></div>
<input type="text" name="fields[Facebook]" class="required size_half"/>
</div>
Assuming you actually mean 'placeholder', you can use the placeholder attribute with modern browsers. For example:
<input placeholder="Facebook name" type="text" name="fields[Facebook]" class="required size_half"/>
There are plenty of jQuery plugins to fix this on older browsers, for example:
http://www.hagenburger.net/BLOG/HTML5-Input-Placeholder-Fix-With-jQuery.html
Related
I am trying to grey out a form field in HTML such that the user cannot edit it, as it will be pre-populated. This is the code section with the issue:
<div class="element-input"><label class="title">Name</label><input value="<?php echo $data ?>" class="large" type="text" name="name" disabled/></div>
and when I render this in the browser, I see that it is pre-populated as planned and I cannot edit it, but when I submit it to the Database, it works and all values are inserted into the db except for the "name" which I suspect is due to the disabled attribute.
Is there anyway, that I can prevent the User from editing the field/grey it out and still have it inserted into the DB?
Simply add the readonly attribute:
<div class="element-input">
<label class="title">Name</label>
<input value="<?php echo $data ?>" class="large" type="text" name="name" readonly />
</div>
A read-only input field cannot be modified (however, a user can tab to it, highlight it, and copy the text from it).
By the way, sometimes it's handy to make a field readonly, and then remove the attribute with javaScript when some other condition is met.
Basic HTML PHP CSS. I have an edit box with a placeholder. In the case that I have edited the fields once before (like username and password), and the browser has cached them, and I return to the form again (e.g., the login page), both the placeholder text and the auto filled values are appearing over top of each other. This is using the osclass code, if that matters. Clicking in the edit box removes the placeholder text, and the auto-filled value remains.
Thanks for the help!
Here's the site -
letmeborrowthat
You should turn the autocomplete off in your code
i.e.,
<input id="email" type="text" name="email" value="" class="input-text" autocomplete="off">
<input id="password" type="password" name="password" value="" class="input-text" autocomplete="off">
You can read it from the mdn here
Kind of an odd question and kinda hard to explain so will try my best.
I am wondering if it is possible to take the following:
<label for="page_name">page name</label><br>
<input type="text" name="page_name" maxlength="50" size="30">
and Display none; in the CSS so that this field isn't visible to anyone filling our the form, so that its left blank. Well not blank I would like to have a preset value so that when the form is filled out, I get all their entered details and I get my preset field "page_name" that has text I have entered so that I can put for example "page 5" so that I can see which page the form has been filled out on.
Is it possible to do it in html? I have done in the past by making each page have its own form and this time around I feel like there must be an easier solution?
Thanks in advance!
Simple use type="hidden" value="your value"
<input type="text" type="hidden" value="your value" name="page_name" maxlength="50" size="30">
and submit this input field with other all fields
This is very possible, I used it to track IP adresses once.
You can simply set the value by hand:
<input type="text" name="page_name" value="Default input value" style="display:none;">
Make sure you set it to display:none; (this can be done from your stylesheet too).
Set the value="default value" wich is what otherwise would be entered by the user.
Example:
function showvalue(){
alert($('input').attr('value'));
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type="text" name="page_name" value="Default input value" style="display:none;">
<button onclick="showvalue()">Show value </button>
I have a form with input elements with the following code:
<label class="label">Activity Name</label>
<label class="input">
<input type="text" name="required" name="activityname">
</label>
I tried using two name attributes since the jquery validation plugin using the name attrbute to validate the input.
I am not sure how to manipulate the inputs though once the form is set, since there could be multiple inputs with a "required" name since they are required fields and need to be validate as such.
I also looked and it is not possible to manpipulate $_POST variables by id.
Use array for multiple values for same name attribute. Your field name will look like "fieldName[]".
<input type="text" class="required" name="fieldName[]">
<input type="text" class="required" name="fieldName[]">
<input type="text" class="required" name="fieldName[]">
I found the first commenter was right. Jquery will select by class or id. I simply set the class to required.
Thanks guys,
I am trying to use a wordpress recaptcha plugin.
The plugin (like wp-recaptcah, better Wp recaptcha) that I am trying to use is only working for the comment form.
But in my case I have created a page and there I have inserted HTML that is managed from the admin panel.
I don't understand how I can use the plugin with my form.
I did not get any shortcode HTML tag to use it directly on the page.
Any suggestion how I can achieve this?
I have created a page in the admin panel and inserted this code. My form is submitted via AJAX:
<div class="First"> Here some static Html is used </div>
<form id="main-form">
<div>
<label>Name</label>
<input class="span6" type="text" maxlength="45" name="name" />
</div>
<div>
<label>Email</label>
<input class="span6" type="text" maxlength="45" name="email" />
</div>
<div>
<label>Phone Number</label>
<input class="span6" type="text" name="phone" placeholder="Enter Phone Number" />
</div>
<div>
<label>Message</label>
<textarea class="span12" name="message" rows="6" ></textarea>
</div>
<div><button class="btn >Send Enquiry</button></div>
</form>
<div class="second">Here some static Html is used </div>
Best suggestion: use Contact Form 7 and Contact Form 7 reCAPTCHA Extension or the Really Simple Captcha plugin, both work well with Contact Form 7.
You'll create the form on the CF7 admin page, then insert it into your WordPress page with a shortcode, which, for many reasons, is much better than writing the form itself in the WordPress text view.
You may use reCAPTCHA Form . It give u a form along with the recaptcha.
http://wordpress.org/plugins/recaptcha-form/
or else you may be wanting the following one instead,
http://wordpress.org/plugins/wp-recaptcha/