Handling null in fields of JSF page in Oracle ADF - javascript

Can I know whether a field's(or a component's) value is 'null' or not in Oracle ADF.?
I have unchecked 'Mandatory' in EO.xml(It's required for us as per the application to un-check that option) and in JSF page (when I run the application) I'm clicking on 'Commit' without entering any text in all the fields, I thought like it should not allow me to Commit as I didn't entered any text. But it's getting Committed without saying any sort of error.
So, my question here is, can I stop it(Committing Without entering text in the fields), if anybody knows please help me..
And
Can I get out of this problem by using JavaScript.?

If the field is not set to be mandatory why should ADF stop you from getting empty data into that field?
You could add your own validator to the field to check if the value is empty instead - but that would basically be the same as turning mandatory on.

Related

Hidden field validation

I have a hidden value in my form, but when I tried a security scan using HP WebInspect tool, its getting manipulated and shows vulnerability. I tried validating this hidden field but still this tool can manipulate the value. What to do for this?
First of all, check if you're using the last version of HP WebInspect tool (from this point forward HPWT).
Marking a hidden field of one html form as a vulnerability and manipulate it's value cannot be called a good tool.
Check the settings page of HPWT. In the Scan Settings / Method there are options related with forms. Check the autofill web forms options for the forms, and if it don't works set the checkbox for Prompt for web forms values during scan ...
If you don't want the manipulated data affect your code don't try to use this $("#someId").text();.
Hope it help.

No additional postbacks work if validation fails on first postback

I have never noticed that ASP.NET automatically shuts down all subsequent postbacks until the field that validated as false is fixed by the user.
My scenario:
I have a form with 3 fields. One of them is a Textbox (txtCarName) with a required field validator and then I have a dropdown(ddlCarMake) with AutoPostBack=true, that filters and enables another dropdown (ddlCarModel) OnSelectedIndexChange.
Lets say the user clicks the save button without filling out the required textbox (txtCarName). They will be notifed that it is a required field.
Before they go and add a value to the required textbox lets say they decide to edit the ddlCarMake because they change their mind. In this case the filter does not happen since all subsequent postbacks are disabled. The user would be extremely confused.
How do ASP.NET developers avoid something like this from creating a poor user experience?
UPDATE:
After contacting Telerik they told me this is a known issue and is currently fixed in their internal build. The next release it will be fixed.
set the dropdownlist CausesValidation="False"

Crm field control order Javascript

I would like to change the order in which the fields in a form get checked.
The field Email should be checked before the field City. They are both obligatory.
I would also like that when the email address is invalid only one Popup is shown (by default I get two- one saying the email is invalid and one saying that the field cannot be null)
Is it possible to change the order of the checks and do the custom checks before the system ones?
Marco
The only supported method of changing the order in which the fields get checked, is changing the order on the form. I'm assuming that CRM just loops through it's collection of controls to perform the field validations. You could attempt to dive into the CRM javascript and figure out a method to hijack it.
A supported way of handling it would be to make the fields not required (either via javascript on the OnLoad, or updating the entity definition itself), and then on the OnSave, writing your own field validation. It's a lot of extra work, and you lose the little red asterisk showing the field is required, but you'd be able to evaluate them in the order you'd like (or display a single message with everything that's missing (why that isn't done by default in CRM I'll never know)), and be able to fix your email invalid / not null message.
CRM does not loop through its collection of controls as specified in the answer above.
The validation of the fields(business required) on a CRM form happen in the order in which they were added to the form, irrespective of where they are placed in the form. So, as of now, the only way to change the order in which they are validated is to add them in the same order as you want them validated.
So far.. I believe the only option to work around this is stated in this link.
http://social.microsoft.com/Forums/en-US/8f402463-23aa-4bc1-862b-4f4093a0cce8/required-fields-order-of-validation?forum=crmdevelopment
Basically you would need to use javascript. Have only one field as mandatory. On change of this field set the next field (in the correct order) to mandatory and so on.. hectic but only way.

Display Value Differently in Input Field Without Changing the Value?

I have an application with an input field that takes a dollar value. I need to change the way this dollar value displays so that the number is formatted with a $ and commas, like $5,550.00 if the user just enters 5550.
I found a way to do this, but doing so causes all hell to break loose in the code that uses the value from this field--it does a bunch of stuff, including database updates that break if given $5,550.00 instead of 5550.
There is a TON of underlying code and I am not empowered to go fix it all. I need to figure out a way to display this value to the user as $5,550.00 but keep the underlying value as 5550.
Any suggestions?
Use 2 text inputs. A "façade" one that the user sees, and a "real" one which is actually submitted to the server with the form. When the user enters text into the visible input, you can use JavaScript to set whatever corresponding value you want into the "real" (hidden) input. That effectively decouples the displayed value from the submitted one. You can even use a plugin such as jQuery Masked Input to do the front-end number formatting for you.
Make sure to only apply this when JS is enabled in the browser, otherwise your form will be broken with JS disabled.
If you are talking about an HTML form, I would submit the form using javascript.
You could revert the value back to unformatted before submitting the form.

Text field clears when editing a form

When I edit a resource and click on the text field in the form - the old value disappears.
it happens across multiple forms
What can cause this behavior ?
is it a rails issue or js ?
Thanks
Possibly a javascript issue - do you have a script that sets any fields deliberate to blank (like a search box, or similar)?
If so, you may have an error in it which is blanking all text boxes.
Turn off JS in your browser and try it...

Categories