I am trying to add validation to fields in user profile form.So I added
<field
name="postal_code"
type="text"
id="postal_code"
**class="validate-numeric"**
description="PLG_USER_PROFILE_FIELD_POSTAL_CODE_DESC"
filter="string"
label="PLG_USER_PROFILE_FIELD_POSTAL_CODE_LABEL"
size="30"
/>
to plugins\user\profile\profiles\profile.xml.Its working fine with user registration.How can this be resolved?
Create a class JFormRulePostal_code extending JFormRule in libraries/joomla/form/rule/ and change type="postal_code" and class="postal_code.
Related
form field image
how do I receive identical form field separately so I can add them to the database. like 3 email input fields or so...
Your question requires more clarification.
If you are using single submit button it can be either of two things, if you are using controlled inputs, as soon as your form is submitted, you can use your state to pass all the data to the backend.
For controlled input you will need to pass onChange handler in each input. Since you are using identical fields I suggest using array of objects and use the index of the array to update the data in the specific index.
If you are using uncontrolled input then you can use form data to retrieve values from the form.
Do remember that you need 'name' in each input for this work.
<form onSubmit={savePassengerSeats}>
<label>
Full Name
<input type="text" id="fullName" name="fullName" />
</label>
<label>
Mobile
<input type="number" id="mobile" name="mobile" />
</label>
<! -- other input -->
<button>Save</button>
</form>
const savePassengerSeats = (event)=>{
const formData = new FormData(event.target)
//use this form data to save data in the db
}
I want to add a in a react semantic UI
but it cannot send the checked value to server even after I name Checkbox like this:
<Form.Field
label="The question is new to the intent library"
name="newType"
control={Field}
component={Checkbox}
/>
This component is inside a form like this:
<Form>
<Form.Field
label="Rating"
control={Field}
name="rate"
component={Rating}
...
/>
<That checkbox ... />
<Form.Field
label="Comment"
control={Field}
name="comment"
component="textarea"
/>
</Form>
Supposed action should carry the checked value in payload, similar to how rating and comment are carried.
I am stuck in this for half a day
Please help me if you notice something. Thanks!
The problem is solved by using the following code
<Form.Field
control={Field}
label="The question is new to the intent library"
name="newType"
component="input"
type="checkbox"
/>
Hi i want to change the tool-tip required message in angular js.
when i hover to text box it shows "Please fill out the fields" message.
I want to change change the message as"Please Enter the value".
How to change the error message.
Here I have attached the link
https://www.w3schools.com/code/tryit.asp?filename=FF9BZ4J5MZOW
open the link and select run.
<input required type="number" min="0" name="No" title="Please Enter the value" />
<input type="text" required name="SKU" placeholder="Textbox" title="Please fill out the fields" />
Make use of the title attribute.
or you can use the HTML5 method to set custom messages. Check here
textEl.setCustomValidity("This feild is required.");
I cannot get html5 validation to work when using it with AngularJS.
I simply need a field to be required, but instead of showing me the error, it submits the form.
I would appreciate anyone's input on how to get the html5 validation to work with AngularJS.
I have the following set up in my web.config file:
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
I have the following set up in my masterpage:
<form id="userForm" name="userForm">
I have the following input box set up with the required attribute:
<div class="col-sm-8">
<input type="text" class="form-control" placeholder="Enter Check Slip Number" id="txtCDDepositSlipNumber" name="txtCDDepositSlipNumber" ng-model="formCtrl.depositSlip.selectedSlipID" required />
</div>
How do you submit form? You listen ng-submit (and have in the form of input type=submit) or handled ng-click on the button/item?
If the handle ng-submit the form - html5 validation works.
write submit button like:
<input type="submit" Value="Submit" ng-click="submitForm(model)">
ng-click will trigger the function you have written on angular controller.
by giving type="submit" to input tag validation would properly work on click of submit button.
I am using angularjs and bootstrap. some of my pages integrated with "typeahead" code.
when I write a character in text field, the dropdown displays but with empty labels.
when I click on any empty label, it fills the textfield with correct value.
The problem is, dropdown not displays labels
any solution.
<input type="text" class="order_input" ng-model="selected_address"
typeahead="rest as rest.name for rest in searchTerms($viewValue,'restaurants/typeahead_address/',{type:restaurant_type})"
placeholder="Enter Postal Code or Address.." />
I am not sure about typeahead
But I actually apply what you are talking about as follows
<input type="text" class="order_input" list="dataSource" placeholder="Enter Postal Code or Address.." />
<datalist id="dataSource" >
<option ng-repeat="rest in allData">{{rest.name}}</option>
</datalist>