I am designing a template, however, I want my contact form to have placeholders. I tried overriding the contact component form file components/com_contact/views/contact/tmpl/default_form.php but it seems to use joomla JForm or something that doesn't give me the ability to add placeholder directly.
$this->form->getInput('contact_name');
$this->form->getInput('contact_email');
...
How can I add placeholde to the contacts? I definitely don't want to replace those pieces of code with naive html code. Neither I want to add a javascript code to do that (I know it's hard but I want it to be done using Joomla core).
You can add hint="Placeholder name" in components/com_contact/models/forms/contact.xml
<field
name="contact_name"
type="text"
label="COM_CONTACT_CONTACT_EMAIL_NAME_LABEL"
description="COM_CONTACT_CONTACT_EMAIL_NAME_DESC"
id="contact-name"
size="30"
filter="string"
required="true"
hint="Placeholder name"
/>
Related
Users are required to pick an option from this select:
<f:form.select name="role" options="{role}" optionLabelField="title" optionValueField="uid" size="4" />
The fluid select element has no required or minItems-Attribute. I don't want to check for missing arguments in the controller because the form is quite complex and I don't want to make users enter all the data again after $this->redirect("show").
I would prefer to have exactly the same implementation as with :
<f:form.textfield name="foo" required="true" />
which works like a charm. How would I do this?
As Ghanshyam pointed out you have to add
additionalAttributes="{required:'required'}"
to the <f:form.select> element. It does not work with whitespace within the attribute value.
I'm working on customising a Wordpress theme called BusinessFinder+. It seems like a really solid theme but I'm getting pressure from my client to make some difficult tweaks.
I'm sure there is a simple snippet for the functions.php file but my skills don't stretch that far.
I'm trying to change the placeholder text for the homepage seach form (just below the hero slider):
https://www.betauk.com/nebetasi/
The current text is "Search keywords", we need it to be "Search members".
Also, there's another search form layout here (on top of the hero image):
https://www.betauk.com/nebetasi/about-beta/
This has the same placeholder text problem, instead of "Search keywords", we need it to be "Search members".
I've tried a simple "str_replace" snippet but it doesn't touch what's in the search forms. I've tried a "str_replace" on other text sections of the homepage (for example) and it works.
Can anyone offer any tips?
If you are not able to find the way to change your placeholder then you can do this by using jquery.
Please check it:
$(document).ready(function(){
$('#searchinput-text').attr("placeholder","Search members");
})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<input type="text" name="s" id="searchinput-text" placeholder="Search keyword" class="searchinput" value="">
with using this code, your both search text box placeholder text will be changed.
Thanks.
Why don't you just go into where the form is (either in widgets or possibly in appearance->editor and amongst the files there) and find the form widget and edit the forms placeholder attribute?
<input type="text" name="s" id="searchinput-text" placeholder="Search keyword" class="searchinput" value="">
Simple HTML/CSS website requires a page with a form with 3 element and also requires to place a form content in an e-mail message. Can it be done with out PHP or any scripting
If you're adamant you that you don't want to use PHP, you can always do something like this: (It's not really considered best practice)
<form action="mailto:example#example.com?Subject=Signup%20Info" enctype="text/plain" method="post">
<p><label for="firstName">First Name:</label><p>
<p><input type="text" name="firstName" id="firstName" required><p><br>
<p><label for="lastName">Last Name:</label><p>
<p><input type="text" name="lastName" id="lastName" required><p><br>
<input type="submit" value="Submit">
</form>
Obviously, the mailto will redirect your user to their default email provider, with your email address ready to send your desired form variables.. Of course it's not entirely 'automatic'.. But I doubt if it's entirely possible without a server side script since HTML are just tags.
Of course I would always recommend using a server side script to validate, store and email your form variables versus using this method I've prescribed above. But enjoy :)
You can simply use PHPMailer. It is Easy to use.
https://github.com/PHPMailer/PHPMailer
I want to implement a custom login module inside wordpress. In the home page, I have this form where the users could register and another form where the users can login to the website.
Is it a better Idea to write custom code inside wordpress to accomplish my goal?
What other alternative do you suggest to it ?
you might be interested in a blog post about building a customized login form, I recently wrote.
It describes how to include a custom login form in any template, how to change the custom output and how to handle redirects after successfull/failed/empty login.
The WordPress-API functions/hooks involved are:
wp_login_form, authenticate and wp_login_failed
Nothing is wrong with writing custom code if you need something specific to happen when a user logs in. Other than writing custom code also is that you could just get an already built plugin!
You can use this code to create a WordPress login form on any page.
<div id="login">
<form name="loginform" id="loginform" action="YOUR_WORDPRESS_FOLDER/wp-login.php" method="post">
<label>Username:<input type="text" name="log" id="log" value="" size="20" tabindex="1" /></label>
<label>Password: <input type="password" name="pwd" id="pwd" value="" size="20" tabindex="2" /></label>
<label class="submit">
<input type="submit" name="submit" id="submit" value="Login ยป" tabindex="3" />
<input type="hidden" name="redirect_to" value="wp-admin/" />
</form>
</div>
Writing custom code for Wordpress is a very common thing. It almost what's expected. Otherwise, you also have many themes and plugins where other people have written code you can use in your own Wordpress site.
Wordpress also has a internal way to Register new users:
If you enable this option under Settings > General, then your login page would have an option to register new users.
Otherwise, if you want to write your own login code, you can start reading around the WP docs, for example in the internal function
register_new_user.
Unless you are creating something complex or special, you can stick to the built-in registration, and also customize with with HTML & CSS as you wish.
I am working on a site in that site I need to customize the registration fields and add new fields in it . How can I do this? I have seen all the possible files but did not find the solution.
Take a look at these options:
http://docs.joomla.org/Can_i_add_registration_fields%3F
http://extensions.joomla.org/extensions/access-a-security/site-access/authentication/14303
Step1 : component/com_users/models/forms/registration.xml ---- open this file and new field what ever you want.
For Example : <field name="newfield" type="text"
description="COM_USERS_REGISTER_NEWFIELD_DESC"
filter="string"
label="COM_USERS_REGISTER_NEWFIELD_LABEL"
message="COM_USERS_REGISTER_FIELD_MESSAGE"
required="true"
size="30"
/>
Step 2: Open your database and add new field manually. You are done now. Test your site and enjoy :-)