Autofill fields in web view android - java

I am creating an application which shows an external website in a webview. I want to fill the username and password fields of that web view with my custom values, but i am not finding any success to do so:
HERE IS THE WEBSITE PAGE SOURCE SNIPPET:
<form name="LoginForm" method="post" action="https://xyz" onsubmit="document.LoginForm.Submit.disabled=true;">
<input type=hidden name="XXX" value="####www#">
<input type=hidden name="YYY" value="xyz.0">
<tr>
<td width="50%">Username
<font class=starmand align="absmiddle">*</font></td>
<td width="50%"><input type="text" name="userName" class="txtfld" autocomplete="off" size="12"/>
</td>
</tr>
<tr>
<td>Password
<font class=starmand align="absmiddle">*</font></td>
<td><input type="password" name="password" size="12" value="" class="txtfld">
</td>
</tr>
<tr>
<td align="right" colspan="2"><input type="submit" name="Submit" value="GO" onclick="return xyz();" class="btnSubmit"></td>
</tr>
</table></td>
</table>
</tbody>
</form>
And here is my Android Code Snippet:
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
browser = (WebView)findViewById(R.id.webView1);
browser.setWebViewClient(new MyBrowser());
browser.getSettings().setLoadsImagesAutomatically(true);
browser.getSettings().setJavaScriptEnabled(true);
browser.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
browser.loadUrl(AppConstants.LOGIN_URL);
}
private class MyBrowser extends WebViewClient {
#Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
String TAG="onPageFinished";
Logger.i(TAG,"Called..");
if(url.equals(AppConstants.LOGIN_URL)) {
Logger.i(TAG,"Login page load done..");
updateStatus("Login Page Loaded..!",TYPE_GREEN);
browser.loadUrl(getLoginScript("USER_NAME","PASS_WORD"));
}
}
}
public static String getLoginScript(String userName,String password){
return "javascript: {" +
"document.getElementsByName('userName').value = '"+userName +"';" +
"document.getElementsByName('password').value = '"+password+"'; };";
}
On the Running the above code:
-I get a new web Page with a text as USER_NAME
Please Help me!
I need to get this working...
Thanks in advance.

It looks like you're loading it as a default of "USER_NAME". To me it would be make more sense if the field is populated with the text "USER_NAME" since you pass that string as a parameter like below:
browser.loadUrl(getLoginScript("USER_NAME","PASS_WORD"));

Related

Java SpringBoot Postgres remove rows

Help me please to remove the row in Postgres by clicking the Del button.
Maybe to link id in DB and id on the HTML page, but how?
Maybe I need to parse the HTML page and pass String id?
Any ideas will help me.
here is my database schema:
<table class="tmc">
<thead>
<tr>
<th>ID</th><th>TMC</th><th>SN</th><th>Owner</th>
</tr>
</thead>
<tbody>
{{#messages}}
<tr>
<td>{{id}}</td>
<td><span>{{text}}</span></td>
<td><i>{{sn}}</i></td>
<td><i>{{owner}}</i></td>
<th><form action="/remove" method="post">
<input type="submit" value="Del"/>
<input type="hidden" name="_csrf" value="{{_csrf.token}}" />
</form>
</th>
</tr>
{{/messages}}
</tbody>
#Entity
#Table(name = "message")
public class Message {
#Id
#GeneratedValue(strategy=GenerationType.AUTO)
private Integer id;
private String text;
private String sn;
private String owner;
public Message() {
}
public Message(String text, String sn, String owner) {
this.text = text;
this.sn = sn;
this.owner = owner;
}
Rows are forming in database by:
#PostMapping("/main")
public String add (
#RequestParam String owner,
#RequestParam String text,
#RequestParam String sn, Map<String, Object> model) {
Message message = new Message (text, sn, owner);
if (text != null && !text.isEmpty() & sn != null && !sn.isEmpty() & owner != null &&
!owner.isEmpty()) {
if (!text.matches("^[0-9].*$")) {
messageRepo2.save(message);
Iterable<Message> messages = messageRepo2.findAll();
model.put("messages", messages);
} else
model.put("error", "ТМЦ не должно начинаться с цифры");
Iterable<Message> messages = messageRepo2.findAll();
model.put("messages", messages);
} else {
model.put("error", "Заполните все поля!");
Iterable<Message> messages = messageRepo2.findAll();
model.put("messages", messages);
}
return "main";
}
There are two issues with your html code:
it would be to let the form element outside the table
need to use <input type="hidden" name="xxx" value="{{xxx}}" /> in order to let it can pass parameter to your controller method
<form action="/remove" method="post">
<input type="hidden" name="_csrf" value="{{_csrf.token}}" />
<table class="tmc">
<thead>
<tr>
<th>ID</th><th>TMC</th><th>SN</th><th>Owner</th>
</tr>
</thead>
<tbody>
{{#messages}}
<tr>
<td>{{id}} <input type="hidden" name="id" value="{{id}}" /></td>
<td><span>{{text}}</span></td>
<td><i>{{sn}}</i> <input type="hidden" name="sn" value="{{sn}}" /></td>
<td><i>{{owner}}</i> <input type="hidden" name="owner" value="{{owner}}" /></td>
<td><input type="submit" value="Del"/></td>
</th>
</tr>
{{/messages}}
</tbody>
</table>
</form>
<thead>
<tr>
<th>ID ТМЦ</th><th>Наименование ТМЦ</th><th>Серийный номер ТМЦ</th><th>За кем числится</th>
</tr>
</thead>
<tbody>
{{#messages}}
<tr>
<td>{{id}}</td>
<td><span>{{text}}</span></td>
<td><i>{{sn}}</i></td>
<td><i>{{owner}}</i></td>
<td>
<form action="/remove" method="post" name="remove">
<input type="submit" value="Удалить"/>
<input type="hidden" name="_csrf" value="{{_csrf.token}}" />
<input type="hidden" name="sn" value="{{sn}}"/>
</form>
</td>
</tr>
{{/messages}}
</tbody>
import com.example.webapp.domain.Message;
import org.springframework.data.repository.CrudRepository;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
#Transactional
public interface MessageDel extends CrudRepository<Message, Long>{
List<Message> deleteBySn (String sn);
}
#PostMapping("/remove")
public String remove (#RequestParam String sn, Map<String, Object> model) {
Message messagedel = new Message (sn);
messageDel.deleteBySn(sn);
model.put("messages", messagedel);
return "redirect:/main";
}

Passing thymeleaf information to a hidden form

I am trying to pass the information from a thymeleaf list and trying to add it to database.
I am getting data from the tmdb and it will be changing so i display the information obtain to the endpoint "/LatestMovies" this information is not saved in the db and ether should it be. so i am trying to add a save button for the custumer to add the movie listed.(its simple it just haves movieid and moviename)
Showing the movies listed i have no problem and it works fine but where i get error is when i add a hidden form. The current code i have is this:
<div class="container">
<table class="table table-hover">
<tr>
<th>Id</th>
<th>Name</th>
</tr>
<tr th:each="LatestMovies : ${latestMovies}">
<td th:text="${LatestMovies.id}"></td>
<td th:text="${LatestMovies.movieName}"></td>
<td>
<form action="#" th:action="#{/LatestMovies}" th:object="${addMovies}" method="post">
<p><input type="hidden" th:field="*{id}" th:attr="value = ${LatestMovies.id}" /></p>
<p><input type="hidden" th:field="*{movieName}" th:attr="value = ${LatestMovies.movieName}" /></p>
<p><input type="submit" value="Submit" /></p>
</form>
</td>
</tr>
</table>
#Controller
public class LatestMoviesController {
#Autowired
private LatestMoviesDao listOfMovies;
#Autowired
private savedMoviesDao movieRepo;
#GetMapping("/LatestMovies")
public String prueba(Model model) {
TmdbMovies movies = new TmdbApi("22914f477aaa3e7f86c6f5434df8d1eb").getMovies();
ResultsPage<MovieDb> movie = movies.getPopularMovies("en", 1);
for(int i=0; i <= 19; i++){
int movieId = movie.getResults().get(i).getId();
String movieName = movie.getResults().get(i).toString();
listOfMovies.save(new LatestMovies(movieId, movieName));
}
model.addAttribute("latestMovies", listOfMovies.findAll());
return "index";
}
#PostMapping("/LatestMovies")
public String save(#ModelAttribute("addMovies") Model model, SavedMovies addMovies) {
movieRepo.save(addMovies);
return "index";
}
}
Thx in advance
First, let's change your form. You don't need to add a new object to it, since you are already iterating through a list of them. That way, you will also avoid having to add the value for each field manually using th:attr. What we are gonna do, is send the required params separately and then build our movie object with them.
<div class="container">
<table class="table table-hover">
<tr>
<th>Id</th>
<th>Name</th>
</tr>
<tr th:each="LatestMovies : ${latestMovies}">
<td th:text="${LatestMovies.id}"></td>
<td th:text="${LatestMovies.movieName}"></td>
<td>
<form th:action="#{/LatestMovies}" method="post">
<p><input type="hidden" th:value="${LatestMovies.id}" name="id"/></p>
<p><input type="hidden" th:value="${LatestMovies.movieName}" name="name"/></p>
<p><input type="submit" value="Submit"/></p>
</form>
</td>
</tr>
</table>
</div>
Now, on your controller, do the following modifications.
#PostMapping("/LatestMovies")
public String save(#RequestParam("id") Integer id, #RequesParam("name") String name) {
SavedMovies movie = new SavedMovies();
movie.setId(id);
movie.setName(name);
movieRepo.save(movie);
return "index";
}
These changes should do the trick.

Form onSubmit() not being called after upgrade to Wicket 7

I'm in the process of upgrading our web app to use Wicket 7 (was using 6.19).
The first page is a login screen, but for some reason, the form's onSubmit() method isn't being called, so on clicking the submit button, I just get the login page re-displayed.
I've consulted the Wicket 7 migration guide, which doesn't mention any specific changes in this area.
It's a pretty straightforward case, as you can see, it's a simple form containing username and password fields
<form wicket:id="loginform" id="loginform" >
<table style="display: table; border: 0px; margin: auto;">
<tr style="display: table-row;">
<td class="login" colspan="2"><span wicket:id="feedback">Feedback</span></td>
</tr>
<tr style="display: table-row;">
<td class="login">
<label for="username"><wicket:message key="username">Username</wicket:message>: </label>
</td>
<td class="login">
<input wicket:id="username" id="username" type="text" name="user" value="" size="30" maxlength="50"/>
</td>
</tr>
<tr style="display: table-row;">
<td class="login">
<label for="password"><wicket:message key="password">Password</wicket:message>: </label>
</td>
<td class="login">
<input wicket:id="password" id="password" type="password" name="pswd" value="" size="30" maxlength="16"/>
</td>
</tr>
<tr style="display: table-row;">
<td class="login"> </td>
<td class="login"><input class="btn" type="submit" name="Login" value="Login" wicket:message="title:loginButtonTitle"/></td>
</tr>
</table>
</form>
Here's the Java code setting up the page components -
public class Login extends UnSecurePageTemplate {
private static final long serialVersionUID = -7202246935258483555L;
#SpringBean private IBrandingService brandingService;
#SpringBean private IRemonService remonService;
#SpringBean private IUserAdminService userAdminService ;
private static final Logger logger = LoggerFactory.getLogger( Login.class);
public Login() {
this(new PageParameters());
}
public Login(PageParameters pageParameters) {
super(pageParameters);
BrandingThemeProperties properties = brandingService.getBrandingThemeProperties();
String welcomeLabel = properties.getProperty("welcome-label");
add(new Label("welcome", welcomeLabel));
add(new Label("loginHeader", getStringFromPropertiesFile("loginInstruction", this)));
LoginForm form = new LoginForm("loginform", new SimpleUser(), pageParameters);
form.add(new FeedbackPanel("feedback"));
add(form);
}
And here's the Login form (the login() method authenticates the user and returns another page) -
public final class LoginForm extends Form<SimpleUser>
{
PageParameters pageParameters;
public LoginForm(String id, SimpleUser simpleUser, PageParameters pageParameters)
{
super(id, new CompoundPropertyModel<SimpleUser>(simpleUser));
this.pageParameters = pageParameters;
add(new TextField<String>("username").setRequired(true).add(StringValidator.maximumLength(50)));
add(new PasswordTextField("password").setResetPassword(true).add(StringValidator.maximumLength(50)));
}
/**
* Called upon form submit. Attempts to authenticate the user.
*/
protected void onSubmit()
{
SimpleUser user = getModel().getObject();
String username = user.getUsername();
String password = user.getPassword();
login(username, password, pageParameters);
}
}
I also tried using a submit Button, but its onSubmit() wasn't called either.

Java – How can I Log into a Website with HtmlUnit?

I am writing a Java program to log into the website my school uses to post grades.
This is the url of the login form: https://ma-andover.myfollett.com/aspen/logon.do
This is the HTML of the login form:
<form name="logonForm" method="post" action="/aspen/logon.do" autocomplete="off"><div><input type="hidden" name="org.apache.struts.taglib.html.TOKEN" value="30883f4c7e25a014d0446b5251aebd9a"></div>
<input type="hidden" id="userEvent" name="userEvent" value="930">
<input type="hidden" id="userParam" name="userParam" value="">
<input type="hidden" id="operationId" name="operationId" value="">
<input type="hidden" id="deploymentId" name="deploymentId" value="ma-andover">
<input type="hidden" id="scrollX" name="scrollX" value="0">
<input type="hidden" id="scrollY" name="scrollY" value="0">
<input type="hidden" id="formFocusField" name="formFocusField" value="username">
<input type="hidden" name="mobile" value="false">
<input type="hidden" name="SSOLoginDone" value="">
<center>
<img src="images/spacer.gif" height="15" width="1">
<script language="JavaScript">
document.forms[0].elements['deploymentId'].value = 'ma-andover';
</script>
<script language="JavaScript">
$(function()
{
$('form').attr('autocomplete', 'off');
var name = $('#username');
var password = $('#password');
name.attr('autocomplete', 'off');
password.attr('autocomplete', 'off');
if (name.val() == '')
{
password.attr('disabled','disabled');
}
});
</script>
<img src="images/spacer.gif" height="30" width="1">
<table border="0" cellpadding="0" cellspacing="0">
<tbody><tr>
<td>
<div id="logonDetailContainer" class="logonDetailContainer">
<table border="0" cellpadding="0" cellspacing="0">
<tbody><tr>
<td>
<label style="text-align: center; margin-bottom: 0px">Andover Public Schools</label>
<img src="images/spacer.gif" height="10" width="1">
<hr class="logonHorizontalRule">
</td>
</tr>
<tr>
<td>
<img src="images/spacer.gif" height="10" width="1">
<input type="text" name="fakeuser" style="display: none">
<input type="password" name="fakepassword" style="display: none">
</td>
</tr>
<tr>
<td class="labelCell">
<label>Login ID</label>
<input type="text" name="username" tabindex="1" value="" onkeypress="$('#password').prop('disabled', false)" id="username" class="logonInput" autocomplete="off">
</td>
</tr>
<tr>
<td class="labelCell">
<label>Password</label>
<input id="password" type="password" name="password" tabindex="2" value="" class="logonInput" autocomplete="off" disabled="disabled">
<a href="javascript:EmbeddedPopup.popupManager.open('passwordRecovery.do?isSecondary=false&deploymentId=ma-andover', 400, 400, 100)" tabindex="5" style="float: right">
I forgot my password
</a>
</td>
</tr>
<tr>
<td width="1" class="logonTopPadding" style="float: left">
<input type="submit" tabindex="3" value="Log On" class="log-button">
</td>
</tr>
</tbody></table>
</div>
</td>
</tr>
</tbody></table>
</center>
<script>
setTimeout(function(){window.location.reload(true);}, 1800000);
</script>
</form>
I am trying to use the following code to log in:
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.HtmlForm;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
public class LoginAttempt {
public static void main(String[] args) throws Exception {
WebClient webClient = new WebClient();
HtmlPage page = (HtmlPage) webClient.getPage("https://ma-andover.myfollett.com/aspen/logon.do");
HtmlForm form = page.getFormByName("logonForm");
form.getInputByName("username").setValueAttribute("myUsername"); //works fine
form.getInputByName("password").setValueAttribute("myPassword"); //does not work
page = form.getInputByValue("Log On").click(); //works fine
System.out.println(page.asText());
}
}
The program fills the username box and clicks the "Log On" button, but it does not fill the password box. What can I change to make this program work? I suspect the "type = 'password'" attribute of the password box has something to do with the problem, but please correct me if I am wrong. Any help is appreciated. Thank you very much.
The target page: https://ma-andover.myfollett.com/aspen/home.do
And this is my output, in case it might be helpful:
Aspen: Log On
Aspen
About Aspen
Andover Public Schools
Login ID myUsername
Password I forgot my password
Log On
Copyright © 2003-2014 Follett School Solutions. All rights reserved.
Follett Corporation Follett Software Company Aspen Terms of Use
You must enter a password.
OK
The password field is disabled until you type something in the username field.
By setting the value in username doesn't trigger the event that manages the enabling of password field.
The below works
public static void main(String[] args) {
WebClient webClient = new WebClient();
try {
HtmlPage page = (HtmlPage) webClient
.getPage("https://ma-andover.myfollett.com/aspen/logon.do");
HtmlForm form = page.getFormByName("logonForm");
form.getInputByName("username").setValueAttribute("myUsername");
HtmlInput passWordInput = form.getInputByName("password");
passWordInput.removeAttribute("disabled");
passWordInput.setValueAttribute("myPassword");
page = form.getInputByValue("Log On").click(); // works fine
System.out.println(page.asText());
} catch (Exception e) {
e.printStackTrace();
} finally {
webClient.close();
}
}
The output is
Aspen: Log On
Aspen
About Aspen
Andover Public Schools
Login ID myUsername
Password I forgot my password
Log On
Copyright © 2003-2014 Follett School Solutions. All rights reserved.
Follett Corporation Follett Software Company Aspen Terms of Use
Invalid login.
OK
To automatically handle the JavaScript, you should use type() instead.
try (WebClient webClient = new WebClient()) {
HtmlPage page = (HtmlPage) webClient.getPage("https://ma-andover.myfollett.com/aspen/logon.do");
HtmlForm form = page.getFormByName("logonForm");
form.getInputByName("username").type("myUsername");
form.getInputByName("password").type("myPassword");
page = form.getInputByValue("Log On").click();
System.out.println(page.asText());
}
I used:
final WebClient webClient = new WebClient())
HtmlPage page = webClient.getPage("url");
((HtmlTextInput) page.getHtmlElementById("usernameID")).setText("Username");
page.getHtmlElementById("passwordID").setAttribute("value","Password");
page.getElementsByTagName("button").get(0).click();
System.out.println(page.asText());
I clicked the button that way because my button doesn't have an id, name, or value, but luckily its the only button on the page. So I just get all the button tags (all one of them) and select the first element in the List to click.

How to keep a check on the "date value" on JSP page as I have modified the date in the setter if it is null

I have some trouble with my jsp page's date value. Basically I have a date picker which allows me to pick date and save it to database. If I do not pick a date, the value is null which I check before setting it and passing it to the database. If its null, I modify it to a dummy date and then save it to database. This part works fine. But if the jsp page throws the not null validation, the value goes to the setter as null, gets modified there to the dummy value and reflected back in the form. I don't want that dummy value to be visible to the user. So is there any way I can put a check on the jsp page so that if the value is a dummy date value it will be visible as null to the user?
<b>Order Information</b>
<table>
<tr>
<td align="left"><form:label for="orId" path="orId" cssErrorClass="error">* Order Id :</form:label></td>
<td align="left"><form:input path="orId" size="35" maxlength="35" /> <form:errors path="orId" /></td>
</tr>
<tr>
<td align="left"><form:label for="orServicetag" path="orServicetag" cssErrorClass="error">* Service tag:</form:label></td>
<td align="left"><form:input path="orServicetag" size="35" maxlength="35" value= "${ticketList.ticServicetag}"/> <form:errors path="orServicetag" /></td>
</tr>
<tr>
<td align="left"><form:label for="orOwnerSUUsername" path="orOwnerSUUsername" cssErrorClass="error">* SU UserName:</form:label></td>
<td align="left"><form:input path="orOwnerSUUsername" id="suusnm" size="35" maxlength="35" value= "${ticketList.ticOwnerSuUsername}"/> <form:errors path="orOwnerSUUsername" /></td>
</tr>
<tr>
<td align="left"><form:label for="orTicId" path="orTicId" cssErrorClass="error">* Ticket Id</form:label></td>
<td align="left"><form:input path="orTicId" id="ticcrdt" size="35" maxlength="35" value= "${ticketList.ticId}"/> <form:errors path="orTicId" /></td>
</tr>
<tr>
<td align="left"><form:label for="orTicCreatedDate" path="orTicCreatedDate" cssErrorClass="error">* Ticket Date (YYYY-MM-DD):</form:label></td>
<td align="left"><form:input path="orTicCreatedDate" size="35" maxlength="35" value= "${ticketList.ticDate}"/> <form:errors path="orTicCreatedDate" /></td>
</tr>
<tr>
<td align="left"><form:label for="orPartOrdered" path="orPartOrdered" cssErrorClass="error">* Part Name :</form:label></td>
<td align="left"><form:input path="orPartOrdered" size="35" maxlength="35" /> <form:errors path="orPartOrdered" /></td>
</tr>
<tr>
<td align="left"><form:label for="orOrderedDate" path="orOrderedDate" cssErrorClass="error">* Part Ordered Date (YYYY-MM-DD):</form:label></td>
<td align="left"><form:input path="orOrderedDate" id="datepicker1" size="35" maxlength="35" /> <form:errors path="orOrderedDate" /></td>
</tr>
<tr>
<td align="left"><form:label for="orRecievedDate" path="orRecievedDate" cssErrorClass="error"> Part Received Date (YYYY-MM-DD):</form:label></td>
<td align="left"><form:input path="orRecievedDate" id="datepicker2" size="35" maxlength="35" /> <form:errors path="orRecievedDate" /></td>
</tr>
<tr>
<td align="left"><form:label for="orStatus" path="orStatus" cssErrorClass="error">* Order Status:</form:label></td>
<td align="left">
<select name="orStatus" id = "orStatus" id="slectboxid1">
<option value = "">---Select---</option>
<option value="Open">Open</option>
<option value="Progress">Progress</option>
<option value="Part Ordered">Part Ordered</option>
<option value="Part Arrived">Part Arrived/ Received</option>
<option value="Waiting for Owner's computer">Waiting for Owner's computer</option>
<option value="Installation">Installation in progress</option>
<option value="Closed">Closed</option>
</select>
<form:errors path="orStatus" /></td>
</tr>
</table>
<div align="center" style="margin-top:15px;" >
<form action="OrderDatabase" method="get">
<input type="submit" name="submit" value="View Order"/>
<input type="submit" name="save" value="save"/> |
<input type="reset" name="reset"/>
</form>
</div>
</form:form>
The Code for the ticketDetailsBean is as follows:
package com.helplaw.beans;
//import java.sql.*;
import java.util.Date;
public class OrderDetailsBean {
private String orId;
private String orPartOrdered;
private Date orTicCreatedDate;
private Date orOrderedDate;
private Date orRecievedDate;
private String orOwnerSUUsername;
private String orServicetag;
private String orStatus;
private int orTicId;
public String getOrId() {
return orId;
}
public void setOrId(String orId) {
this.orId = orId;
}
public String getOrPartOrdered() {
return orPartOrdered;
}
public void setOrPartOrdered(String orPartOrdered) {
this.orPartOrdered = orPartOrdered;
}
public Date getOrTicCreatedDate() {
return orTicCreatedDate;
}
public void setOrTicCreatedDate(Date orTicCreatedDate) {
this.orTicCreatedDate = orTicCreatedDate;
}
public Date getOrOrderedDate() {
return orOrderedDate;
}
public void setOrOrderedDate(Date orOrderedDate) {
this.orOrderedDate = orOrderedDate;
}
public Date getOrRecievedDate() {
return orRecievedDate;
}
public void setOrRecievedDate(Date orRecievedDate) {
if(orRecievedDate == null){
System.out.println("d11:" + orRecievedDate);
this.orRecievedDate = new Date(000000001);
}
else if(orRecievedDate.toString().equals("1969-12-31")){
System.out.println("d12:" + orRecievedDate);
this.orRecievedDate = null;
}
else{
System.out.println("d13:" + orRecievedDate);
this.orRecievedDate = orRecievedDate;
}
}
public String getOrOwnerSUUsername() {
return orOwnerSUUsername;
}
public void setOrOwnerSUUsername(String orOwnerSUUsername) {
this.orOwnerSUUsername = orOwnerSUUsername;
}
public String getOrServicetag() {
return orServicetag;
}
public void setOrServicetag(String orServicetag) {
this.orServicetag = orServicetag;
}
public String getOrStatus() {
return orStatus;
}
public void setOrStatus(String orStatus) {
this.orStatus = orStatus;
}
public int getOrTicId() {
return orTicId;
}
public void setOrTicId(int orTicId) {
this.orTicId = orTicId;
}
}
Just remove the NULL validation because it will never be null in your case where you are always setting a dummy value.
Alternatively, you can achieve it using hidden input field.
Steps to follow:
create hidden input fields one for each date input field.
set the value in hidden input field if value is changed in actual date input field using JavaScript
now set the dummy value in hidden input field rather than actual input field if value is null
read values from hidden input fields to save it in database
Note: swap the path attribute date input field with hidden input fields so that it will be picked from hidden input fields when form is submitted.

Categories

Resources