Client-side form validation fails
Hi guys,
Below is a very simple form with some client side validation.
on submission it takes me to the results page with out popping an
error. I checked it in both IE and Firefox. I checked the source
after displaying the page and there are javascript elements built.
I am testing this on my local box, with coldfusion mx 7 on
apache.
Is there anything special I have to do with the server
settings, or browser settings or there something else.
Thanks,
Frank
<cfform action="save.cfm">
<p>
<cfinput type="text" name="first_name" required="yes"
message="enter your first name" validateat="onsubmit">
: First Name<br />
<cfinput type="text" name="last_name" required="yes"
message="enter your last name" validateat="onsubmit">
: Last Name<br />
<br />
Do you love me?<br /><br />
<cfinput type="radio" name="love" value="yes">
Yes<br />
<cfinput type="radio" name="love" value="no">
No<br />
<cfinput type="radio" name="love" value="Maybe">
Maybe<br />
<br />
How should we contact you?<br /><br />
<cfinput type="checkbox" name="contact" value="email">
Email?<br />
<cfinput type="checkbox" name="contact" value="paper
airplane">
Paper Airplane?<br />
<cfinput type="checkbox" name="contact" value="can
phone">
Can Phone?<br />
<br />
<cfquery name="temp" datasource="hrp">
SELECT distinct department.department_name
FROM department
</cfquery>
What department do you work for?<br /><br />
<cfselect name="dept" size="1" query="temp"
value="department_name" display="department_name">
</cfselect>
<br /><br />
<cfinput type="submit" name="submit" value="submit">
</p>
</cfform>
Odd, indeed. The validation Javascript works on my PC,
showing an alert. I only replaced your query with mine. There might
be something wrong with your installation of the Coldfusion system
folder, /CFIDE/scripts/.
Similar Messages
-
Client Side Javascript Validation not Working in Struts 1.x version
hi,
I'm following the steps provioded in the below link for Javascript Client side validation but still it is not working.I'm struggling to get this work.
[http://www.visualbuilder.com/jsp/struts/tutorial2/pageorder/9/|http://www.visualbuilder.com/jsp/struts/tutorial2/pageorder/9/]
"The framework automatically generates the browser specific JavaScript and validate the data only at the client side."From the above statement i undertstand that framework itself generates the javascript function for validating the field mentioned in validations.xml file so that we dont have to explicitly write a javascript function for
validating the fields
(or)
Do we need to call an explicit function
Please need help on this.
I have followed all the steps mentioned on the above link but Client Side Javascript Validation not Working in Struts 1.x version....
Thanks and Regards,
DeepakHi,
Please find my steps below....still getting an error.
2> which version of commons-validation.jar needs to be downloaded ...Link please
downloaded the latest commons-validation.jar and placed in lib.refreshed the project,and did a build.
3> which DTD name to be specified in "validator-rules.xml" which is in accordance to commons-validator.jar file.
validator-rules.xml ::
<!DOCTYPE form-validation PUBLIC
"-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.0//EN"
"http://jakarta.apache.org/commons/dtds/validator_1_0.dtd">validation.xml:
<!DOCTYPE form-validation PUBLIC
"-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.0//EN"
"http://jakarta.apache.org/commons/dtds/validator_1_0.dtd">
i did as u said and im gettiong the below errorNov 5, 2009 4:33:08 PM org.apache.struts.validator.ValidatorPlugIn initResources
SEVERE: Invalid byte 2 of 2-byte UTF-8 sequence.
org.apache.commons.digester.xmlrules.XmlLoadException: Invalid byte 2 of 2-byte UTF-8 sequence.
at org.apache.commons.digester.xmlrules.FromXmlRuleSet.addRuleInstances(FromXmlRuleSet.java:139)
at org.apache.commons.digester.Digester.addRuleSet(Digester.java:1610)
at org.apache.commons.digester.xmlrules.DigesterLoader.createDigester(DigesterLoader.java:89)
at org.apache.commons.validator.ValidatorResourcesInitializer.initialize(ValidatorResourcesInitializer.java:122)
at org.apache.struts.validator.ValidatorPlugIn.initResources(ValidatorPlugIn.java:238)
at org.apache.struts.validator.ValidatorPlugIn.init(ValidatorPlugIn.java:181)
at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:1036)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:455)
at javax.servlet.GenericServlet.init(GenericServlet.java:212)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1139)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:966)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3996)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4266)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:927)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:890)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1150)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:448)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
Need help forum members.....
Please reply to my question 1 which has been asked before as belowDo i need to write explicit javascript function for validation in Struts (or) struts generates the javascript function by itself.??? Please explain with an example....
Edited by: Deepak_A_L on Nov 5, 2009 4:37 PM -
The Group Policy client-side extension Scripts failed ...
This is an error I've been seeing forever and it was always the impression that upgrading would resolve it, but it never has even in 10.3. 100% of our users get these errors in the Event Viewer:
Event Type: Error
Event Source: Userenv
Event Category: None
Event ID: 1085
Date: 10/21/2010
Time: 8:04:52 AM
User: NT AUTHORITY\SYSTEM
Computer: XXXXXX
Description:
The Group Policy client-side extension Scripts failed to execute. Please look for any errors reported earlier by that extension.
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
We also seem to have flakey policy issues where once in awhile a user will not be able to logon to Windows with Workstation Only while getting the " not allowed to logon interactively" message, other times the users report not being able to access the Windows Date and Time Properties and further sometimes they are unable to make system changes.
We have troubleshooted this and the only resolutions we've found are to run zac cc, zac ref, zac pl and sometimes it seems like deleting c:\windows\system32\grouppolicy will help.
In regards to the Event Viewer entry I posted, on any given machine I can issue the command gpupdate and it will put another entry into the Event Viewer (sometimes multiple ones). I've learned through research that if I "clean up" c:\windows\system32\grouppolicy\gpt.ini the errors go away, but once the policy is refreshed they come right back.
This is the version ZenWorks gives the users:
[General]
gPCFunctionalityVersion=2
gPCFunctionalityVersion=2
gPCMachineExtensionNames=[{35378EAC-683F-11D2-A89A-00C04FBBCFA2}{0F6B957D-509E-11D1-A7CC-0000F87571E3}][{3610EDA5-77EF-11D2-8DC5-00C04FA31A66}{0F6B957D-509E-11D1-A7CC-0000F87571E3}][{42B5FAAE-6536-11D2-AE5A-0000F87571E3}{40B6664F-4972-11D1-A7CA-0000F87571E3}][{4CFB60C1-FAA6-47F1-89AA-0B18730C9FD3}{0F6B957D-509E-11D1-A7CC-0000F87571E3}][{827D319E-6EAC-11D2-A4EA-00C04F79F83A}{803E14A0-B4FB-11D0-A0D0-00A0C90F574B}]
Version=6488106
gPCUserExtensionNames=[{35378EAC-683F-11D2-A89A-00C04FBBCFA2}{0F6B957E-509E-11D1-A7CC-0000F87571E3}][{42B5FAAE-6536-11D2-AE5A-0000F87571E3}{40B66650-4972-11D1-A7CA-0000F87571E3}][{4CFB60C1-FAA6-47F1-89AA-0B18730C9FD3}{0F6B957E-509E-11D1-A7CC-0000F87571E3}][{A2E30F80-D7DE-11D2-BBDE-00C04F86AE3B}{FC715823-C5FB-11D1-9EEF-00A0C90347FF}]
This is the version I cleaned up:
[General]
gPCFunctionalityVersion=2
gPCUserExtensionNames=[{35378EAC-683F-11D2-A89A-00C04FBBCFA2}{0F6B957E-509E-11D1-A7CC-0000F87571E3}][{4CFB60C1-FAA6-47F1-89AA-0B18730C9FD3}{0F6B957E-509E-11D1-A7CC-0000F87571E3}][{A2E30F80-D7DE-11D2-BBDE-00C04F86AE3B}{FC715823-C5FB-11D1-9EEF-00A0C90347FF}]
gPCUserExtensionNames=[{35378EAC-683F-11D2-A89A-00C04FBBCFA2}{0F6B957E-509E-11D1-A7CC-0000F87571E3}][{A2E30F80-D7DE-11D2-BBDE-00C04F86AE3B}{FC715823-C5FB-11D1-9EEF-00A0C90347FF}]
I'm not sure how to get Zenworks to use the cleaned up version nor and I too sure what those extra extensions are and how they got in there. I may need to contact Novell in regards to this, but since I'm already working on an SR with them I figured I'd go ahead and post here first.
Any help or advice would be greatly appreciated.Here are the groups I'm using. NOTE: These have been in affect throughout the issues experienced. Users will work perfectly fine then suddenly the problem will start happening without any policy change on our side.
-Member of-
Network Configuration Operators+
Remote Desktop Users+
Users+
-Assigned Rights under a group I called "Other Rights"-
Access this computer from network
Change the system time
Log on locally
Shut down the system
The only condition I have is that these issues happen when logging in Workstation Only and I'm not able to recreate the problem on demand with tests.
Originally Posted by craig_wilson
The "Interactive Logon" is a Windows Security Permission.
It is generally assigned to certain local groups such as "User".
Which groups are assigned this right can be changed manually and
controlled by local security policies.
When user's get this error, it generally means their account is not in a
local group that has been assigned that right.
If using "DLU", make sure the user accounts are a member of "Users".
And If anyone was messing with security policies, make sure they did not
take away "Interactive Logons" from anyone.
On 10/29/2010 7:06 AM, jcsmith1 wrote:
>
> Thanks for replying craig.
>
> My policy woes have only grown since my first post. We are currently
> testing the removal of administrative rights and now we're having
> teleworkers (who login Workstation Only) getting the message "policy
> does not allow interactive login". What -seems- to fix it is a zac cc,
> zac ref and zac pl, however we just started getting call backs from
> users.
>
> I seem to have no further leads and Novell's ZenWorks tech supports
> seems to be going through some kind of painful-to-the-customer
> transition as one of my thoughts on resolving the issue is to go to 10.3
> or 10.3.1, but my Satellites appear to be upgrading but in reality do
> not upgrade (but the primary servers upgraded) (See SR 10655976331).
>
> Does anyone knows how to troubleshoot policy issues when the users
> aren't loggin into ZCM?
>
> craig_wilson;2036646 Wrote:
>> See: 'Group Policy Error: The Group Policy client-side extension Script
>> failed to execute.'
>> (Group Policy Error: The Group Policy client-side extension Script failed to execute.)
>>
>> This would never be fixed in any patch, since it would be the job of
>> GPEDIT to properly maintain the GPT.INI.
>>
>> Most of the Time these errors are cosmetic and caused by stray script
>> extensions.
>>
>> You may want to create an Enhancement Request to allow the creation of
>> "Filters" so certain errors are discarded and not sent to the DB/ZCC.
>> This way an Admin could choose to filter out various error messages
>> that
>> they deem are not actually of concern.
>>
>> On 10/21/2010 9:36 AM, jcsmith1 wrote:
>>>
>>> This is an error I've been seeing forever and it was always the
>>> impression that upgrading would resolve it, but it never has even in
>>> 10.3. 100% of our users get these errors in the Event Viewer:
>>>
>>> -Event Type: Error
>>> Event Source: Userenv
>>> Event Category: None
>>> Event ID: 1085
>>> Date: 10/21/2010
>>> Time: 8:04:52 AM
>>> User: NT AUTHORITY\SYSTEM
>>> Computer: XXXXXX
>>> Description:
>>> The Group Policy client-side extension Scripts failed to execute.
>>> Please look for any errors reported earlier by that extension.
>>>
>>> For more information, see Help and Support Center at
>>> http://go.microsoft.com/fwlink/events.asp.
>>> -
>>> We also seem to have flakey policy issues where once in awhile a
>> user
>>> will not be able to logon to Windows with Workstation Only while
>> getting
>>> the " not allowed to logon interactively" message, other times the
>> users
>>> report not being able to access the Windows Date and Time Properties
>> and
>>> further sometimes they are unable to make system changes.
>>>
>>> We have troubleshooted this and the only resolutions we've found are
>> to
>>> run zac cc, zac ref, zac pl and sometimes it seems like deleting
>>> c:\windows\system32\grouppolicy will help.
>>>
>>> In regards to the Event Viewer entry I posted, on any given machine
>> I
>>> can issue the command gpupdate and it will put another entry into
>> the
>>> Event Viewer (sometimes multiple ones). I've learned through
>> research
>>> that if I "clean up" c:\windows\system32\grouppolicy\gpt.ini the
>> errors
>>> go away, but once the policy is refreshed they come right back.
>>>
>>> This is the version ZenWorks gives the users:
>>>> [General]
>>>> gPCFunctionalityVersion=2
>>>> gPCFunctionalityVersion=2
>>>>
>> gPCMachineExtensionNames=[{35378EAC-683F-11D2-A89A-00C04FBBCFA2}{0F6B957D-509E-11D1-A7CC-0000F87571E3}][{3610EDA5-77EF-11D2-8DC5-00C04FA31A66}{0F6B957D-509E-11D1-A7CC-0000F87571E3}][{42B5FAAE-6536-11D2-AE5A-0000F87571E3}{40B6664F-4972-11D1-A7CA-0000F87571E3}][{4CFB60C1-FAA6-47F1-89AA-0B18730C9FD3}{0F6B957D-509E-11D1-A7CC-0000F87571E3}][{827D319E-6EAC-11D2-A4EA-00C04F79F83A}{803E14A0-B4FB-11D0-A0D0-00A0C90F574B}]
>>>> Version=6488106
>>>>
>> gPCUserExtensionNames=[{35378EAC-683F-11D2-A89A-00C04FBBCFA2}{0F6B957E-509E-11D1-A7CC-0000F87571E3}][{42B5FAAE-6536-11D2-AE5A-0000F87571E3}{40B66650-4972-11D1-A7CA-0000F87571E3}][{4CFB60C1-FAA6-47F1-89AA-0B18730C9FD3}{0F6B957E-509E-11D1-A7CC-0000F87571E3}][{A2E30F80-D7DE-11D2-BBDE-00C04F86AE3B}{FC715823-C5FB-11D1-9EEF-00A0C90347FF}]
>>>>
>>>>
>>>
>>> This is the version I cleaned up:
>>>> [General]
>>>> gPCFunctionalityVersion=2
>>>>
>> gPCUserExtensionNames=[{35378EAC-683F-11D2-A89A-00C04FBBCFA2}{0F6B957E-509E-11D1-A7CC-0000F87571E3}][{4CFB60C1-FAA6-47F1-89AA-0B18730C9FD3}{0F6B957E-509E-11D1-A7CC-0000F87571E3}][{A2E30F80-D7DE-11D2-BBDE-00C04F86AE3B}{FC715823-C5FB-11D1-9EEF-00A0C90347FF}]
>>>>
>> gPCUserExtensionNames=[{35378EAC-683F-11D2-A89A-00C04FBBCFA2}{0F6B957E-509E-11D1-A7CC-0000F87571E3}][{A2E30F80-D7DE-11D2-BBDE-00C04F86AE3B}{FC715823-C5FB-11D1-9EEF-00A0C90347FF}]
>>>>
>>>>
>>>
>>> I'm not sure how to get Zenworks to use the cleaned up version nor
>> and
>>> I too sure what those extra extensions are and how they got in there.
>> I
>>> may need to contact Novell in regards to this, but since I'm already
>>> working on an SR with them I figured I'd go ahead and post here
>> first.
>>>
>>> Any help or advice would be greatly appreciated.
>>>
>>>
>>
>>
>> --
>> Craig Wilson - MCNE, MCSE, CCNA
>> Novell Knowledge Partner
>>
>> Novell does not officially monitor these forums.
>>
>> Suggestions/Opinions/Statements made by me are solely my own.
>> These thoughts may not be shared by either Novell or any rational
>> human.
>
>
Craig Wilson - MCNE, MCSE, CCNA
Novell Knowledge Partner
Novell does not officially monitor these forums.
Suggestions/Opinions/Statements made by me are solely my own.
These thoughts may not be shared by either Novell or any rational human. -
I want to give a client side email validation in a insert screen.
This sounds like a generic ADF question that is not related to JHeadstart. Can you please ask this question at the JDeveloper forum at http://otn.oracle.com/discussionforums/jdev.html ?
Thanks,
Sandra Muller
JHeadstart Team
Oracle Consulting -
Hi exprets.
How can i validate a form with jsp without the involvement of any client side script so that when a field is not filled properly it should display the form again with the data filled previously and a message against the incorrect field.
I have a generic asp code that can be used with any form. There are some complexities in it for me in converting it to jsp because I am very net to it.
Here is the asp code:
validateForm.asp
<%
const errorSymbol = "<font color=red><b>*</b></font>"
dim dicError
set dicError = server.createObject("scripting.dictionary")
sub checkForm
dim fieldName, fieldValue, pFieldValue
for each field in request.form
if left(field, 1) = "_" then
' is validation field , obtain field name
fieldName = right( field, len( field ) - 1)
' obtain field value
fieldValue = request.form(field)
select case lCase(fieldValue)
case "required"
if trim(request.form(fieldName)) = "" then
dicError(fieldName) = "<font size=-2 face=Verdana, Arial, Helvetica, sans-serif color=blue>" & fieldName & " is required</font>"
end if
case "date"
if Not isDate(request.form(fieldName)) then
dicError(fieldName) = "<font size=-2 face=Verdana, Arial, Helvetica, sans-serif color=blue>" & fieldName & "must be a date</font>"
end if
case "number"
pFieldValue=request.form(fieldName)
if Not isNumeric(pFieldValue) or (instr(pFieldValue,",")<>0) then
dicError(fieldName) = "<font size=-2 face=Verdana, Arial, Helvetica, sans-serif color=blue>" & fieldName & " must be a number</font>"
end if
case "intnumber"
pFieldValue=request.form(fieldName)
if Not isNumeric(pFieldValue) or (instr(pFieldValue,",")<>0) or (instr(pFieldValue,".")<>0) then
dicError(fieldName) = "<font size=-2 face=Verdana, Arial, Helvetica, sans-serif color=blue>" & fieldName & " must be an integer</font>"
end if
case "email"
if instr(request.form(fieldName),"@")=0 or instr(request.form(fieldName),".")=0 then
dicError(fieldName) = "<font size=-2 face=Verdana, Arial, Helvetica, sans-serif color=blue>" & fieldName & " must be an email</font>"
end if
case "phone"
pFieldValue=request.form(fieldName)
pFieldValue=replace(pFieldValue," ","")
pFieldValue=replace(pFieldValue,"-","")
pFieldValue=replace(pFieldValue,"(","")
pFieldValue=replace(pFieldValue,")","")
pFieldValue=replace(pFieldValue,"+","")
if Not isNumeric(pFieldValue) then
dicError(fieldName) = "<font size=-2 face=Verdana, Arial, Helvetica, sans-serif color=blue>" & fieldName & " must be a phone number</font>"
end if
case "login"
Dim i, ch, login
login = false
pFieldValue = request.Form(fieldName)
if len(pFieldValue) < 5 then
login = false
else
for i=1 to len(pFieldValue)
ch = Mid(pFieldValue, i, 1)
if i=1 then
if(((ch >= "A") and (ch <= "Z")) or((ch >= "a") and (ch <= "z"))) then
login = true
else
login = false
exit for
end if
end if
if (i > 1) then
if(((ch >= "A")and(ch <= "Z"))or((ch >= "a")and(ch <= "z"))or((ch >= "0")and(ch <= "9"))or(ch = "_")) then
login = true
else
login = false
exit for
end if
end if
next
end if
if login = false then
dicError(fieldName) = "<font size=-2 face=Verdana, Arial, Helvetica, sans-serif color=blue>" & fieldName & " must start with an alphabet, having numbers (0-9), alphabets, the underscore and no spaces</font>"
end if
end select
end if
next
end sub
sub validateForm2(byVal successPage)
if request.ServerVariables("CONTENT_LENGTH") > 0 then
checkForm
' if no errors, then successPage
if dicError.Count = 0 then
' build success querystring
tString=Cstr("")
for each field in request.form
if left(field, 1) <> "_" then
fieldName = field
fieldValue = request.form(fieldName)
tString=tString &fieldName& "=" &Server.UrlEncode(fieldValue)& "&"
end if
next
Dim PageRed
PageRed= successPage&"?"& tString
response.Redirect(PageRed)
end if
end if
end sub
sub validateError
dim countRow
countRow=cInt(0)
for each field in dicError
if countRow=0 then
response.write "<br>"
end if
response.write "<br> - " & dicError(field)
countRow=countRow+1
next
if countRow>0 then
response.write "<br>"
end if
end sub
sub validate( byVal fieldName, byVal validType )
%> <input name="_<%=fieldName%>" type="hidden" value="<%=validType%>"> <%
if dicError.Exists(fieldName) then
response.write errorSymbol
end if
end sub
sub textbox(byVal fieldName , byVal fieldValue, byVal fieldSize, byVal fieldType, byVal fieldTitle, byVal maxLength, byVal action)
dim lastValue
lastValue = request.form(fieldName)
select case fieldType
case "textbox"
%>
<input name="<%=fieldName%>" size="<%=fieldSize%>" value="<%
if trim(fieldValue)<>"" then
response.write fieldValue
else
response.write Server.HTMLEncode(lastValue)
end if%>" style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid;"
title="<%=fieldTitle%>" maxlength="<%=maxLength%>" <%=action%>>
<%
case "hidden"
%>
<input type="hidden" name="<%=fieldName%>" size="<%=fieldSize%>" value="<%
if trim(fieldValue)<>"" then
response.write fieldValue
else
response.write Server.HTMLEncode(lastValue)
end if%>">
<%
case "password"
%><input name="<%=fieldName%>" type="password" size="<%=fieldSize%>" value="<%
if trim(fieldValue)<>"" then
response.write fieldValue
else
response.write server.HTMLEncode(lastValue)
end if%>" style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid;"
title="<%=fieldTitle%>" maxlength="<%=maxLength%>">
<%
case "textarea"
%>
<textarea name="<%=fieldName%>" rows="3" cols="<%=fieldSize%>" style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid;"
title="<%=fieldTitle%>" <%=action%>><%
if trim(fieldValue)<>"" then
response.write fieldValue
else
response.write Server.HTMLEncode(trim(lastValue))
end if
%></textarea>
<%
end select
end sub %>
End of validateform.asp
and I use it like this:
<!--#include file="includes/validateForm.asp" -->
<%
on error resume next
%>
<body leftmargin="0" rightmargin="0" topmargin="0">
<%
validateForm "addcustomer.asp"
%>
<form action="" method="post" name="form1" >
<%validateError%>
Customer Name
<%textbox "Name", pName, 30, "textbox", "Customer Name", 50, ""%>
<%validate "Name", "required"%>
the last two scriptlets create a Name field which is required. If user does not fill it an error message appears against it.
Can someone help me please.
SajidWow... some ASP code... its strange to see ASP these days as its been ages since i have coded in ASP.
Well to answer your question, there are couple of options to overcome this issue.
1) Make use of Struts Framework. It automatically takes care for the error handling(ok not automatically), but error handling of the type you are looking for is built into it and one needs to modify according to his/her own application.
2) The other option will be to submit the data to the servlet. Populate the data into the respective fields of a Bean and put the bean into session/request as per ur requirements. On the JSP page, check if there is some data in the bean. If yes, then populate the values of HTML controls from the BEAN and the one that is empty/has custom error that you might enter in servlet can be displayed as an error message to the user.
Hopefully this works for you. Give it a shot and its correctly said, that "necessity is the mother of invention" -
I want to do a client side validation of a date field. Date which is coming from a calendar should not be greater than the system date.and shows a alert message at the time of form submit.
You will need to write a custom JSF converter to achieve this, see this link for more info:
http://download-east.oracle.com/docs/html/B25947_01/web_val006.htm
Steven Davelaar,
JHeadstart Team. -
JSF 1.0 - client side state saving fails
Existing screen worked fine in Beta with client-side state saving. Fails in 1.0 Release with:
java.lang.NullPointerException
at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:997)
at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:1008)
at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:1022)
at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:1008)
at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:1008)
at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:1008)
at com.sun.faces.application.StateManagerImpl.restoreComponentState(StateManagerImpl.java:273)
at com.sun.faces.application.StateManagerImpl.restoreView(StateManagerImpl.java:186)
at com.sun.faces.application.ViewHandlerImpl.restoreView(ViewHandlerImpl.java:239)
at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:157)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
This exception is found in tomcat log. Nothing found in debug log. I switched state saving to server and screen works, however, I need the application to work with client state saving.
Some screens in application work with client state saving. Some don't. All those that fail have the same exception as above.
Any ideas?Hello
I have the same problem but i am not using any verbatim tag in my case the problem only appears when i am using two custom validators for a inputtexd in the same page .
the problem is solved using the server saving method but i want to use client saving method.
If you have any ideas please help .
this is the exeption :
java.lang.NullPointerException at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:1004) at com.sun.faces.application.StateManagerImpl.restoreComponentState(StateManagerImpl.java:352) at com.sun.faces.application.StateManagerImpl.restoreView(StateManagerImpl.java:240) at com.sun.faces.application.ViewHandlerImpl.restoreView(ViewHandlerImpl.java:228) at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:157) at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200) at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197) at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65) at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:122) at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:663) at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330) at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:830) at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:285) at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:126) at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186) at java.lang.Thread.run(Thread.java:534)
thanks
yinbr
Message was edited by:
yinbr -
PLEASE help with server-side form validation using PHP!!!
I feel like im going round and round in circles with this, after looking into all sorts of server-side advice i've come to the conclusion that i want to validate my form using server-side validation with PHP.
So my form has several drop down menu's and textareas (not all of them need validation). For the part of my form i would like to validate, all i want is the drop downs to have to be changed/selected. So just a simple message like "You must select an option" if customers haven't done so. For the textareas, they just need to be filled out, so a message like "Information required" to come up if customers haven't done so.
I believe i need to create a PHP page say for example 'error.php' place the validation code in there and set this part of the the form to -
<form name="product"form action="error.php" method="post" class="product_form">
BUT im getting really confused with creating the code for the error.php. Please please can anyone help me with this!!!???
Here are the drop down menu's i need validation on, error message being "You must select an option",
"figurine"
"engraving"
"font"
and here are the textareas that need validating, error message "Information required",
"test"
"Name"
"house"
"line_1"
"line_2"
"county"
"postcode"
"tel"
www.milesmemorials.com/product-GK1.html
I'd really appreciate any help!!!Ness_quick wrote:
Great thats good enough for me. In that case, would you please be able to help me create the javascript for the above validation?? If you could just help me create it for this page i can amend it for all the other pages. I'd really really appreciate it!!!
Can you follow the below example?? Obviously AFTER validation has been successful you need to collect the information from the form and send it to the recipient email address...that's where you can use php. I'll check back tomorrow and see how you are doing.
<!DOCTYPE HTML>
<html><head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Form validation</title>
<!-- VALIDATE ORDER FORM -->
<script type="text/javascript">
<!--
function RequiredFormFields() {
// inform customer to provide figurine choice
var figurine = document.forms.product.figurine.value;
if (figurine == "-- Select figurine --")
alert("Please provide figurine choice");
return false;
// inform customer to provide engraving choice
var engraving = document.forms.product.engraving.value;
if (engraving == "-- Select engraving --")
alert("Please provide engraving choice");
return false;
// inform customer to provide font choice
var font = document.forms.product.font.value;
if (font == "-- Select style --")
alert("Please select font style");
return false;
// inform customer to provide their name
var Name = document.forms.product.Name.value;
if (Name == null || Name == "")
alert("Please provide your name");
return false;
// inform customer to provide their house number/name
var house = document.forms.product.house.value;
if (house == null || house == "")
alert("Please provide your house number/name");
return false;
} // end function
-->
</script>
</head>
<body>
<form name="product" form action="processForm.php" method="post" class="product_form" onsubmit="return RequiredFormFields()">
<p class="product_form_options">Choice of Figurine<br>
<select name="figurine" class="productButton" id="figurine" onChange="Recalculate()">
<option selected>-- Select figurine --</option>
<option value="7031">Tropical Green Granite with bronze sacred heart figurine as pictured(£7031)</option>
<option value="5216">Tropical Green Granite with bronze effect sacred heart figurine (£5216)</option>
<option value="5216">Tropical Green Granite with reconstituded figurine MF122(£5216)</option>
</select>
</p>
<p class="product_form_options">Engraved Lettering<br>
<select name="engraving" class="productButton" id="engraving" onChange="Recalculate()">
<option selected>-- Select engraving --</option>
<option value="2.30">Sandblast and enamel painted (£2.30/letter)</option>
<option value="2.80">Sandblast and guilded (£2.80/letter)</option>
<option value="2.20">Maintenance free (£2.20/letter)</option>
<option value="3.73">Traditionally hand cut and enamel painted (£3.73/letter)</option>
<option value="3.98">Traditionally hand cut and gilded (£3.98/letter)</option>
<option value="4.34">Raised lead and enamel painted (£4.34/letter)</option>
<option value="4.59">Raised lead and gilded (£4.59/letter)</option>
</select>
</p>
<p class="product_form_options">Letter/Font Style<br>
<select name="font" class="productButton" id="font" >
<option selected>-- Select style --</option>
<option value="Maintenance free">Maintenance free </option>
<option value="White painted block">White painted block</option>
<option value="White painted roman">White painted roman</option>
<option value="White painted Script">White painted Script</option>
<option value="White painted Celtic">White painted Celtic</option>
<option value="White painted Nova">White painted Nova</option>
<option value="Sliver painted block">Sliver painted block</option>
<option value="Sliver painted roman">Sliver painted roman</option>
<option value="Sliver painted Script">Sliver painted Script</option>
<option value="Sliver painted Celtic">Sliver painted Celtic</option>
<option value="Sliver painted Nova">Sliver painted Nova</option>
<option value="Gold leaf painted block">Gold leaf painted block</option>
<option value="Gold leaf painted roman">Gold leaf painted roman</option>
<option value="Gold leaf painted Script">Gold leaf painted Script</option>
<option value="Gold leaf painted Celtic">Gold leaf painted Celtic</option>
<option value="Gold leaf painted Nova">Gold leaf painted Nova</option>
<option value="Gold leaf painted Old English">Gold leaf painted Old English</option>
</select>
</p>
<p>
<p>Name<br>
<input name="Name" type="text" id="Name" value="">
</p>
<p>House name or number:<br>
<input name="house" type="text" id="house" size="67">
</p>
<p>
<input name="submit" type="submit" class="place_order" id="submit" value="Place order">
</p>
</form>
</body>
</html> -
Querystring is lost when form validation failes
I have a form that uses form validation and <i>@jpf:validation-error-forward name="validation-failure" return-to="currentPage"</i>.<br><br>
When the validation of the form failes it returns to the current page as it is supposed to but it looses the querystring that i use to show the correct content in the form. :-(<br><br>
I have tryed to find a way to also send the querystring but without success so far. Any ideas anyone?Can the query string be stored in pageflow scoped variable? That way it will exist as long as the portlet instance exists.
--SJ -
Submit by email not working as form validation failed.
Ive created a form with mulitple pages. Three pages require form validation.
Each page is a unique process so I'm trying to use the "Submit button" to only submit that
particular page. I've created dummy fields as defaults to cure the validation problem but
can't seem to get the e-mail button to work. I also created a email dummy button with the
scripting:
EmailSubmitButton.execEvent("click");
I did this to try to force the the form to be sumitted via PDF. I am a novice at this so please
help. I'd be happy to send the form as well for reviewYou may need to enable usage rights in your form. You must have version 8 to do this. Open the form in Acrobat Pro (not Livecycle), click on Advanced tab, then select "enable usage rights in Adobe Reader"
-
Plz Solve this Error in " Client Side Address Validation in Struts "
Hi,
i have created struts project and foll code is written as foll :
plz find out error in code :
struts-config.xml code
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
<data-sources />
<form-beans >
<form-bean name="AddressForm" type="com.projectvalidator.form.AddressForm" />
</form-beans>
<global-exceptions />
<global-forwards />
<action-mappings >
<action
input="/validateaddress.jsp"
name="AddressForm"
path="/address"
scope="request"
validate="true"
type="com.projectvalidator.action.AddressAction">
<forward name="success" path="/success.jsp"/>
<forward name="failure" path="/validateaddress.jsp"/>
</action>
</action-mappings>
<message-resources parameter="MessageResources" />
<!-- Validator plugin -->
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames" value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
</plug-in>
</struts-config>
MessageResources.properties file code
AddressForm.name=Name
AddressForm.address=Address
AddressForm.email=EmailAddress
validation.xml
<?xml version="1.0" encoding="UTF-8"?>
<form-validation>
<formset>
<!-- Address form Validation-->
<form name="AddressForm">
<field property="name"
depends="required" >
<arg key="AddressForm.name"/>
</field>
<field property="address"
depends="required" >
<arg key="AddressForm.address"/>
</field>
<field property="email"
depends="required" >
<arg key="AddressForm.email"/>
</field>
</form>
</formset>
</form-validation>
validationaddress.jsp
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-template" prefix="template" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-nested" prefix="nested" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html:html locale="true">
<head>
<html:base />
<title>validateaddress.jsp</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
</head>
<body bgcolor=#fdffca>
<html:form action="/address" method="post" onsubmit="return validateAddressForm(this);">
<p>
<html:errors/><p>
name : <html:text property="name" size="30" maxlength="30" />
address : <html:text property="address" size="30" maxlength="30" />
emailaddress : <html:text property="email" size="30" maxlength="30" />
<html:submit>Submit</html:submit>
<html:cancel>Cancel</html:cancel>
<!-- Begin Validator Javascript Function-->
<html:javascript formName="AddressForm"/>
<!-- End of Validator Javascript Function-->
</html:form>
</body>
</html:html>
AddressForm.java
//Created by MyEclipse Struts
// XSL source (default): platform:/plugin/com.genuitec.eclipse.cross.easystruts.eclipse_3.9.210/xslt/JavaClass.xsl
package com.projectvalidator.form;
import org.apache.struts.validator.ValidatorForm;
* MyEclipse Struts
* Creation date: 02-23-2006
* XDoclet definition:
* @struts:form name="AddressForm"
public class AddressForm extends ValidatorForm {
// --------------------------------------------------------- Instance Variables
/** address property */
private String address;
/** emailaddress property */
private String email;
/** name property */
private String name;
// --------------------------------------------------------- Methods
* Returns the address.
* @return String
public String getAddress() {
return address;
* Set the address.
* @param address The address to set
public void setAddress(String address) {
this.address = address;
* Returns the emailaddress.
* @return String
public String getEmail() {
return email;
* Set the emailaddress.
* @param emailaddress The emailaddress to set
public void setEmail(String email) {
this.email = email;
* Returns the name.
* @return String
public String getName() {
return name;
* Set the name.
* @param name The name to set
public void setName(String name) {
this.name = name;
AddressAction.java
//Created by MyEclipse Struts
// XSL source (default): platform:/plugin/com.genuitec.eclipse.cross.easystruts.eclipse_3.9.210/xslt/JavaClass.xsl
package com.projectvalidator.action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.projectvalidator.form.AddressForm;
* MyEclipse Struts
* Creation date: 02-23-2006
* XDoclet definition:
* @struts:action path="/address" name="AddressForm" input="/validateaddress.jsp" scope="request" validate="true"
* @struts:action-forward name="success" path="success.jsp" redirect="true"
* @struts:action-forward name="failure" path="validateaddress.jsp" redirect="true"
public class AddressAction extends Action {
// --------------------------------------------------------- Instance Variables
// --------------------------------------------------------- Methods
* Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) {
AddressForm AddressForm = (AddressForm) form;
// TODO Auto-generated method stub
//String forward="";
//if (AddressForm.getName().equalsIgnoreCase("admin"));
//return mapping.findForward(forward);
return null;
==========================================
PLZ REPLY ME ANYONE , I AM NOT GETTING OUTPUT , i am using jboss application server, i am getting a pop-up window as below:
null is required
null is required
null is required
i hope any one replies meHi,
i have created struts project and foll code is written as foll :
plz find out error in code :
struts-config.xml code
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
<data-sources />
<form-beans >
<form-bean name="AddressForm" type="com.projectvalidator.form.AddressForm" />
</form-beans>
<global-exceptions />
<global-forwards />
<action-mappings >
<action
input="/validateaddress.jsp"
name="AddressForm"
path="/address"
scope="request"
validate="true"
type="com.projectvalidator.action.AddressAction">
<forward name="success" path="/success.jsp"/>
<forward name="failure" path="/validateaddress.jsp"/>
</action>
</action-mappings>
<message-resources parameter="MessageResources" />
<!-- Validator plugin -->
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames" value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
</plug-in>
</struts-config>
MessageResources.properties file code
AddressForm.name=Name
AddressForm.address=Address
AddressForm.email=EmailAddress
validation.xml
<?xml version="1.0" encoding="UTF-8"?>
<form-validation>
<formset>
<!-- Address form Validation-->
<form name="AddressForm">
<field property="name"
depends="required" >
<arg key="AddressForm.name"/>
</field>
<field property="address"
depends="required" >
<arg key="AddressForm.address"/>
</field>
<field property="email"
depends="required" >
<arg key="AddressForm.email"/>
</field>
</form>
</formset>
</form-validation>
validationaddress.jsp
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-template" prefix="template" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-nested" prefix="nested" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html:html locale="true">
<head>
<html:base />
<title>validateaddress.jsp</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
</head>
<body bgcolor=#fdffca>
<html:form action="/address" method="post" onsubmit="return validateAddressForm(this);">
<p>
<html:errors/><p>
name : <html:text property="name" size="30" maxlength="30" />
address : <html:text property="address" size="30" maxlength="30" />
emailaddress : <html:text property="email" size="30" maxlength="30" />
<html:submit>Submit</html:submit>
<html:cancel>Cancel</html:cancel>
<!-- Begin Validator Javascript Function-->
<html:javascript formName="AddressForm"/>
<!-- End of Validator Javascript Function-->
</html:form>
</body>
</html:html>
AddressForm.java
//Created by MyEclipse Struts
// XSL source (default): platform:/plugin/com.genuitec.eclipse.cross.easystruts.eclipse_3.9.210/xslt/JavaClass.xsl
package com.projectvalidator.form;
import org.apache.struts.validator.ValidatorForm;
* MyEclipse Struts
* Creation date: 02-23-2006
* XDoclet definition:
* @struts:form name="AddressForm"
public class AddressForm extends ValidatorForm {
// --------------------------------------------------------- Instance Variables
/** address property */
private String address;
/** emailaddress property */
private String email;
/** name property */
private String name;
// --------------------------------------------------------- Methods
* Returns the address.
* @return String
public String getAddress() {
return address;
* Set the address.
* @param address The address to set
public void setAddress(String address) {
this.address = address;
* Returns the emailaddress.
* @return String
public String getEmail() {
return email;
* Set the emailaddress.
* @param emailaddress The emailaddress to set
public void setEmail(String email) {
this.email = email;
* Returns the name.
* @return String
public String getName() {
return name;
* Set the name.
* @param name The name to set
public void setName(String name) {
this.name = name;
AddressAction.java
//Created by MyEclipse Struts
// XSL source (default): platform:/plugin/com.genuitec.eclipse.cross.easystruts.eclipse_3.9.210/xslt/JavaClass.xsl
package com.projectvalidator.action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.projectvalidator.form.AddressForm;
* MyEclipse Struts
* Creation date: 02-23-2006
* XDoclet definition:
* @struts:action path="/address" name="AddressForm" input="/validateaddress.jsp" scope="request" validate="true"
* @struts:action-forward name="success" path="success.jsp" redirect="true"
* @struts:action-forward name="failure" path="validateaddress.jsp" redirect="true"
public class AddressAction extends Action {
// --------------------------------------------------------- Instance Variables
// --------------------------------------------------------- Methods
* Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) {
AddressForm AddressForm = (AddressForm) form;
// TODO Auto-generated method stub
//String forward="";
//if (AddressForm.getName().equalsIgnoreCase("admin"));
//return mapping.findForward(forward);
return null;
==========================================
PLZ REPLY ME ANYONE , I AM NOT GETTING OUTPUT , i am using jboss application server, i am getting a pop-up window as below:
null is required
null is required
null is required
i hope any one replies me -
Client side conflict solution fails
Hallo,
In our application we want to resolve synchronisation conflicts on the
client side.
For a specific SyncBO. We want the the client data to be dominant.
To achieve this we tried two ways of conflict resolvance:
1. We used the ErrorConflictInbox to loop over all conflicts for that
SyncBO and used the method acceptClientSyncBo on the SyncBoResponse
object
try{MeIterator meIter = SmartSyncRuntime.getInstance().getInboxNotifier
().getErrorConflictInbox().getSyncBoResponses
(assignmentSyncBoDescriptor,
SyncBoResponseType.CONFLICT);resolvedAssignmentConflicts =
meIter.hasNext();while (meIter.hasNext()){SyncBoResponse conflict =
(SyncBoResponse) meIter.next();if(conflict.getSyncBoResponseState
().equals(SyncBoResponseState.INITIAL)){conflict.acceptClientSyncBo
();}}} catch (Exception e){log.logException(e, true);}
2. We registered a SyncReplyObserver in which we used the method
acceptClientSyncBo on the SyncBoResponse object
public SynchronizationControllerImpl(){SmartSyncRuntime.getInstance
().getInboxNotifier().registerSyncReplyObserver(assignmentObserver);}
private AssignmentDeltaObserver assignmentObserver = new
AssignmentDeltaObserver();
private class AssignmentDeltaObserver implements SyncReplyObserver
{public SyncBoDescriptor[] observerSyncBoTypes(){return new
SyncBoDescriptor[] { assignmentSyncBoDescriptor };}public SyncReplyType
[] observeSyncReplyTypes(){return new SyncReplyType[] {
SyncReplyType.CONFLICT };}public void syncReplyReceived(SyncReply arg0,
SyncBoDescriptor arg1, String arg2){try{SyncBoResponse conflict =
SmartSyncRuntime.getInstance().getInboxNotifier().getErrorConflictInbox
().getSyncBoResponse(assignmentSyncBoDescriptor, new BigInteger
(arg2));conflict.acceptClientSyncBo();} catch (Exception ignored)
{log.logException(ignored,true);}}}
In the first case we did not get every conflict, in fact we only got
ONE unresolved conflict and the next time we only got SyncBoResponses
with status resolved.
In the second case we were able to process every conflict, but than the
following problem which applied also to the first case occured:
The SyncBoResponseState was changed to RESOLVED, but the BusinessObject
remaind in state 16 (BusinessObject.STATUS_IN_SYNC) and the client-/
and serverdata differed.
As far as I had understood, the client data now should have been send
to the server on the next synchronization, but the data had not been
synchronized until the BusinessObject had been changed again on the
client.
As it seemed to be necessary to change the data after the conflict had
been resolved, to make it synchronize again, we tried to make a change - change back cycle on some data, but although the BusinessObject's
state changed to 8 (BusinessObject.STATUS_GLOBAL) on the first change,
the state went back to 16 on re-modification.
More importantly the data had not been synchronized when the client was
synchronized again.
Has anyone done this before and am I on the right way? Why does not it work?
Greetings,
Kaihello kai,
your first code doesn't have any problem at all. im just
wondering the line with //????// comment. do you assume
that the first iterator object is a resolved conflict?
after resolving the conflict, the SyncBoResponse instance
having a RESOLVED will stay in your local repository. you
have to call delete() method.
by the way, at which timing does your application resolve
the conflicts?
try{
MeIterator meIter = SmartSyncRuntime.getInstance()
.getInboxNotifier().getErrorConflictInbox()
.getSyncBoResponses(assignmentSyncBoDescriptor,
SyncBoResponseType.CONFLICT);
<b>//????//</b>
resolvedAssignmentConflicts = meIter.hasNext();
while (meIter.hasNext()){
SyncBoResponse conflict =(SyncBoResponse) meIter.next();
if(conflict.getSyncBoResponseState().equals (SyncBoResponseState.INITIAL)){
conflict.acceptClientSyncBo();
<b>//removed the RESOLVED ones; you may add state check as well
conflict.delete();</b>
} catch (Exception e){log.logException(e, true);}
the same thing goes to your 2nd code. you have to call the
delete() method of the SyncBoResponse once they are processed.
what really happens when you invoke the acceptClientSyncBo
method is that
1)the quarantined client SyncBo is copied to tempObject
2)the server data is applied; making the client SyncBo a
global image - state GLOBAL/SYNCHED
3)the client modification is applied using the tempObject
-> client syncBo state is now INCONSISTENT; there's a delta
data to be uploaded.
4)SyncBoResponse is transitional to RESOLVED
on your next sync, this delta data will be sent to the server
just like a normal delta upload. until your success response
for that delta upload message is received in the client,
your SyncBo will be in its INSYNC state.
hope this clear up some of your doubts.
just let me know if you need more details.
regards
jo -
Invoking UNIX executables from client side forms
Has anyone had any success invoking UNIX executables from forms without using "hosted" rsh and/or rcp commands? There are too many of these UNIX executables to convert to PL/SQL procedures. Have developed a technique using dbms_pipe package but requires a daemon on UNIX side. Any thoughts or sugesstions? Thanks.
I have done alot of this and the only way that I know of is using dbms_pipe. It looks alot harder than it really is. Also you may want to look at using Forms Server on your database server. I know that you can use the host command, which if running on your database server will send the command to your unix server.
-
How to make client side validations using NWDS
Hi Frndz..
Am creating UIs using NWDS ,i made tthe validations @ servr side n i have 2 made this validations @ clinet side ,but am not aware how it is????
can anyone help me in this regard.
THANKS & REGARDS
Rajesh Kumarchk it
/people/martin.kellermann2/blog/2006/12/17/client-side-input-validation-with-htmlb--the-basics
http://help.sap.com/saphelp_nw04/helpdata/en/43/067941a51a1a09e10000000a155106/frameset.htm
/people/kirupanand.venkatapathi2/blog/2005/12/18/client-side-validation-in-dynpage
http://help.sap.com/saphelp_nw04s/helpdata/en/8e/e3a942ad920c31e10000000a1550b0/frameset.htm
/thread/86123 [original link is broken]
https://media.sdn.sap.com/html/submitted_docs/dotnet/Programming%20with%20PDK%20for%20.NET/SAP%20NetWeaver%20.NET%20Controls/Event%20Handling/Client%20Side%20Event%20Handling.htm -
How to make the server slide form validation using JSP?
anyone knows how to do server-side form validation??
Thanks in advancedtry this way
//create a validation java class in that class u create separate methods for validating
for example if u want to validate that a particular text box should not be empty
then u can try this way
say like this
class ServerValidation()
boolean message=false;
public static boolean isTextBoxEmpty(String value)
if(value.length<1)
System.out.println("Text box is empty");
message=false
else
message=true
return message
now say u r having a html page in which there is a text box on submiting u call say validate.jsp
in this jsp u write this way
<%
String message=request.getParameter("name of ur text box");
boolean b=ServerValidation.isTextBoxEmpty(message)
if(b)
//valid is true do ur other activity
else
String messageToUser="Please Enter Some value"
u can now display this message on jsp and create a back button
%>
hope its clear
Maybe you are looking for
-
Difference between customizing request and workbench request?
Hi , What is the difference between customizing request and workbench request? please reply.........
-
Deleting Photo's on Iphone?
Why when I select multiple photos on my iphone to delete, it says delete from everywhere? I only want them to be off of my iphone but I don't want them completely deleted from my photostream/computer/other devices. I just don't want them on my phone
-
4:3 and 16:9 aspect ratio
Ive been producing a video editor using the free tool AVISYNTH. But would like to do most of the math processing in director since its faster. My problem is, lets say I have an image whose dimensions are 576x409 I want to cut out a part of that image
-
All of a sudden, the down button became hard to press, I don't hear that clicking noise it used to make when I press it. The up button is fine, it's just the down button. It still works but I have to press it really hard in order for it to work. How
-
Cannot use create user as j2ee_admin
Hi, All: The system is: double stack, ABAP & Java, NW04s SR2 SP12, BI + EP, AIX + Oracle. After successful installation, we logon the portal as j2ee_admin, when choose User Administartion -> Identity management, error occurs with message: "A required