cancel
Showing results for 
Search instead for 
Did you mean: 

Need to reset form fields

Former Member
0 Kudos

Hi,

I need to reset my form fields. I had achived this previously when my fields were normal "input" type fields.

But I am unable to do so after I changed my fields to the hbj:input types.

I have written the following code:

function resetFields(){

alert("inside reset");

var funName = htmlb_formid+"_getHtmlbElementId";

fun = window[funName];

var inputField1 = eval(fun("contFnameField"));

var inputString1 = inputField1.getValue().toString();

if(inputString1 !=null)

{

contFnameField.setValue("");

}

}

This gives me an error.

How can I achieve this?

Also I have a text area in my form. So I cannot specify "jsObjectneeded = true" for this textarea field of mine. How can i perform validations on this field before form submit.

I have one more query-- I find that when I click on submit button on the page, It does not invoke the associated controller.

The button code is -


<hbj:button							id = "Contactus"
	text = "SUBMIT" 
	disabled = "false" 	
	onClientClick="validateFields()"			onClick = "SendMail"	
	design="STANDARD" 
	/>

I find that validateFields() is invoked, but SendMail() in my controller is not invoked.

Please give me your views on this.

-Ashwini.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Ashwini,

I think it should be

inputField1.setValue(""); instead of contFnameField.setValue("");

There should be some log if onClick event of button is not called though it doesn't give any exception. Check that out.

Regards,

Harini S

Former Member
0 Kudos

Thanks harini,

That solved the reset problem for input fields..

Any idea how validation can be imposed for text area field?

Ashwini.

Former Member
0 Kudos

Hi Ashwini,

textarea comes as html tag and not as htmlb tag. So may be u can get its id in normal way. Not sure of this but check out.

http://forums.aspfree.com/html-help-7/textarea-validation-110455.html

Regards,

Harini S

Former Member
0 Kudos

Sorry Harini,

My mistake.. I am not using the text area tag.. but the "textEdit" tag..

- Ashwini

Former Member
0 Kudos

Hi Ashwini,

I just checked out. I think it isn't possible to do client side validation for textEdit. Only server side validation is possible.

Refer to Javascript API.

http://help.sap.com/saphelp_nw2004s/helpdata/en/43/067941a51a1a09e10000000a155106/content.htm

Client side validation can be done to the components mentioned in this only.

Regards,

Harini S