Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

JSP - Mandatory field

Posted on 2006-11-20
6
Medium Priority
?
3,485 Views
Last Modified: 2012-05-05
I need to create a simple page in which contains the user name and email address.

Both fields have * next to label which indicates the field must be entered.

If the Submit button is selected, I need to make sure those field must be provided, If not, a error message is displayed, stating that field must be provided.

I know how to do in JSF using JDeveloper 10g.

But we are using SAP AS it doesnt support the JSF features.

Please advise.
0
Comment
Question by:LeanMoreTryMore
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 10

Expert Comment

by:jaggernat
ID: 17984281
does SAP AS  support struts api. you can use the struts validation framework if you want to validate the two fields server side.
If there is no support for struts api, you can use javascript validation for client side validation
something like..
function validate
{
if(document.forms[0].username.value == "")
{
alert("Please enter a valid Username");
}
//similarly for email address
0
 

Author Comment

by:LeanMoreTryMore
ID: 17990243
Anything goes to SAP is very strange, i am not sure whether it support struts api.

as this is quite urgent, the quick fix may be used java script.

How do i invoke the above java script where the SUBMIT button is clicked ?
0
 
LVL 10

Expert Comment

by:jaggernat
ID: 17991897
function submitAction()
{
if(document.forms[0].username.value == "") {
alert("Please enter a valid Username");
}
if(document.forms[0].email.value == "")
{
alert("Please enter a valid Email");
}
}

//username and email are the field name

<input type="button" name="" value="Submit" onclick="submitAction();">
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:LeanMoreTryMore
ID: 17992173
Thanks.

Yes. it does pop up the alert message. Where the OK button is clicked it calls the next page. I want to stop if the required field is blank. Please advise

the following is the  the form use post to the next page

<form name="wizard" method="POST" action="/ServiceRequest">
0
 
LVL 10

Accepted Solution

by:
jaggernat earned 900 total points
ID: 17992204
try this


function submitAction()
{
if(document.forms[0].username.value == "") {
alert("Please enter a valid Username");
return false;
}
if(document.forms[0].email.value == "")
{
alert("Please enter a valid Email");
return false;
}
}
0
 
LVL 10

Expert Comment

by:jaggernat
ID: 18000357
if the solution fully solved your problem, you are supposed to give an "A".
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

With its various features, Office 365 can not only help you with your day-to-day business tasks, it can also do wonders for your marketing campaign.
As much as Microsoft wants to kill off PST file support, just as they tried to do with public folders, there are still times when it is useful or downright necessary to export Exchange mailboxes to PST files. Thankfully, it is still possible to e…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question