How to set a field required in joomla 2.5? - required

I have created a component. In this component I have created the form fields using xml file.
In xml file I set the attribute required='required' of a text field and that field become a required field automatically.
But Now I have a component which has created the form in a php file using html input tags. And now I want to make a textfield required in that form so how will I do this? As in the input tag I can't enter the required='required' attribute.
So what should I do with this so that the textbox becomes a required field and without entering some text in that field it should not be submitted.

Go through the following website to add validation for the php form fields.
http://buildinternet.com/2008/12/how-to-validate-a-form-complete-with-error-messages-using-php-part-1/
http://phpmaster.com/form-validation-with-php/

Related

Programatically add text field to Contact Form 7

I would like to add a text field to all my forms programatically. There is a hook for adding hidden fields (wpcf7_form_hidden_fields) but I can not find one for regular fields. I tried modifying the form via wpcf7_form_elements which works, I get my new field. However it is not really part of the Contact Form 7 cosmos, I can not use wpcf7 validation on it.
Is there another way?
Thanks

Contact form 7 file field related query

We have required conditional file field that depends on another dropdown field. If dropdown field value YES then file field will show and added required option but if dropdown value NO then file field not show and remove the required option.
We have done the hide show logic in file field but not able to do required option on off. Can anyone please suggest how to do that?
Without the exact website link, it is difficult to explain perfectly. However, from what I understand what you need to do here is to implement a custom validation.
You can refer this link to understand how to implement custom validation.
Basic flow of code:
1. Give ID to the drop down so that you can bind an onchange event with it
2. Bind an onchange event that hide/show the file field
3. Create custom required validation which checks your drop down value and decides whether the other field is required or not
This should do your job... Feel free to ask other questions and post your website uRL and code to get a better answer.

Issue with Kendo Asp.Net MVC Grid Popup template Add/Update record

I'm using Kendo Asp.Net MVC Grid Control.
I'm facing a problem while adding new record.
1) I'm Using editable.Mode(GridEditMode.PopUp)
2) I'v created a template for new record.
3) In Template I'v Editor Control (Which allow enter text with HTLM tags like Paragraph , underline, bold letters, etc).
Up to here every thing good. :-)
Here is my problem:
When I enter text without adding HTML tags the New record is adding and Updating in the grid.
But, When I enter any HTML tags. It is not adding new record and updating grid.
I have added .Encoded(false) for Grid column and Editor Control(In Template)
Thanks in help.
Most probably, the HTML value is posted non-encoded and triggers the ASP.NET request validation. If you check the browser console, you may see the infamous potentially dangerous request.form value was detected from the client message. Either disable security validation, or set the AllowHtml attribute on the model field that will receive the HTML string. Here is some more information about request validation in ASP.NET.

In sitecore How to access the section in codebehind

I have tried with field value
<sc:fieldrenderer fieldname="field" runat="server"/>
I am able to get the field value but I need to access the section that contains number of fields
What is the way to achieve that?
Sections are only to get the fields organized so there isn't a control to render all the fields of a section, you have to render field by field.

How to add ajax property to an existing field in a content type in drupal

I have created content type with several fields. I want to add an ajax property to some fields in that content type using hook_form_alter.
Is there any way to inject the ajax property to an existing field if I know the machine name of that field?
Is there any way to update an existing field state using ajax?
How can I do this programatically?

Resources