struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeromy Evans <jeromy.ev...@blueskyminds.com.au>
Subject Re: [S2] form not retrieving values in IE
Date Mon, 18 Feb 2008 08:33:35 GMT
You're using the ajax theme which means it's probably a javascript problem.
I can't see a submit button in your code, but a known problem in IE is 
that if the target div of the form contains the form itself the form's 
values are lost.
ie. In IE, the "Loading..." text is written to the DOM prior to 
submitting the form, causing the values in the form to be discarded 
prior to posting to your action.

You can fix this by adding showLoadingText="false" to any ajax-themed 
tag that submits the form (the form, submit, anchor etc)

I can't think of what else it could be unless there's other javascript 
not shown below.

Hope that helps,
Jeromy Evans

carmi_cd wrote:
> I have a form that works find in Firefox but when I tried to run it in
> Internet Explorer, all the values
> from the form input box are returned null. 
>
> I dont know what should I do to fix this problem in IE, 
> here is my form code
>
> <s:form id="adminForm" name="adminForm" theme="ajax">
> <s:textfield name="employeeId" id="employeeId" label="Employee ID"
> labelposition="left" value="%{edituser.empId}" size="10"/>
> <s:textfield name="lastname" id="lastname" label="Lastname"
> labelposition="left" value="%{edituser.lastName}" size="30"/>
> <s:textfield name="firstname" id="firstname" label="First Name"
> labelposition="left" value="%{edituser.firstName}"  size="30"/>
> <s:textfield name="middlename" id="middlename" label="Middle Name"
> labelposition="left" value="%{edituser.middleName}" size="30"/>
> <s:textfield name="position" id="position" label="Position"
> labelposition="left" value="%{edituser.position}" size="40"/>
> <s:textfield name="username" id="username" label="Username"
> labelposition="left" value="%{edituser.userName}" size="15"/>
> <s:textfield name="password" id="password" label="Password"
> labelposition="left" value="%{edituser.password}" size="15"/>
> <s:textfield name="password2" id="password2" label="Confirm Password"
> value="%{edituser.password}" labelposition="left" size="15"/>
> </s:form>
>
> here is my action class code:
>     public String save() {                
>         UserBean userBean = new UserBean();
>         User newUser = new User();
>         System.out.println(getLastname());
>         newUser.setLastName(getLastname());
>         newUser.setFirstName(getFirstname());
>         newUser.setMiddleName(getMiddlename());
>         newUser.setPosition(getPosition());
>         newUser.setEmpId(getEmployeeId());
>         newUser.setUserName(getUsername());
>         newUser.setPassword(getPassword());        
>         selectedIds =getSelectedIds();         
>         if(userid == null || userid.equals("false")){
>             userBean.addUser(newUser,selectedIds); 
>         }else{            
>             newUser.setUserId(userid);
>             userBean.updateUser(newUser,selectedIds);   
>         }
>         userid=null; 
>         return SUCCESS;        
>     }
>
>     public String getUserid() {
>         return userid;
>     } 
>
>     public void setUserid(String value) {
>         this.userid = value;
>     }
>     
>     public String[] getSelectedGroup() {       
>         return selectedGroup;
>     }
>     
>     public void setSelectedGroup(String[] value) {
>        this.selectedGroup=value;
>     }        
>
>     public String getTask() {
>         return task;
>     }
>
>     public void setTask(String task) {
>         this.task = task;
>     }
>
>     public String getLastname() {
>         return lastname;
>     }
>
>     public void setLastname(String lastname) {
>         this.lastname = lastname;
>     }
>
>     public String getFirstname() {
>         return firstname;
>     }
>
>     public void setFirstname(String firstname) {
>         this.firstname = firstname;
>     }
>
>     public String getMiddlename() {
>         return middlename;
>     }
>
>     public void setMiddlename(String middlename) {
>         this.middlename = middlename;
>     }
>
>     public String getPosition() {
>         return position;
>     }
>
>     public void setPosition(String position) {
>         this.position = position;
>     }
>
>     public String getEmployeeId() {
>         return employeeId;
>     }
>
>     public void setEmployeeId(String employeeId) {
>         this.employeeId = employeeId;
>     }
>
>     public String getUsername() {
>         return username;
>     }
>
>     public void setUsername(String username) {
>         this.username = username;
>     }
>
>     public String getPassword() {
>         return password;
>     }
>
>     public void setPassword(String password) {
>         this.password = password;
>     }
>     
>     public String getPassword2() {
>         return password2;
>     }
>
>     public void setPassword2(String password2) {
>         this.password2 = password2;
>     }    
>
>
> I have getter and setter for every input field in my form, i dont know whats
> causing the problem.
> when I try to print out lastname, it said it is null.
>
> please help me. this problem only appears in Internet Explorer. Thanks in
> advance
>
>   

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message