JQuery in Domino

Hi

I am new to Jquery. I wanted to use in our application. Can someone guide me where should add the “Jquery” js file in the DB and How can I use in the form and it features.

It would be great if If I get the steps.

Subject: JQuery in Domino

Ramnath,

Here are the basics to start,

1- Download ‘jquery.js’ file from JQuery site and paste the code in page , save as ‘Jquery.js’ and change the content type of the pase as “Text/javascript”.

2- Design your form , add your jquery page in head section of the form,

“<script type="text/javascript" src="/” + @webdbname+ “/jquery.js">”

3- At the end to code , get the syntax from jquery site .

For more ref, Here r the sample code for creating document on web using jquery/ajax.

I assume you have added jquery.js file in head section.

-Step1-


designing form , ( Sample one )

Put the code on your form and passthru,

#DataForm{ font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 60%; width: 500px; padding-left: 4px; } #DataForm label { font-size: 100%; color: #333333; margin: 0px; }
Contact Form

Name    

<input type="text" name="name" id="name" size="30" value="" class="text-input" /><br />

This field is required.

  <br>

Email     

<input type="text" name="email" id="email" size="30" value="" class="text-input" /><br />

This field is required.

  <br>

Phone    

<input type="text" name="phone" id="phone" size="30" value="" class="text-input" /><br />

This field is required.

<br>

Country 

<input type="text" name="country" id="country" size="30" value="" class="text-input" /><br />

This field is required.

<br />

<br />

  <input type="submit" name="submit" class="button" id="submit_btn" value="Send" />

</fieldset>

-Step 2-


Put following code in JS header,


$(function() {

$('.error').hide();

$(".button").click(function() {

           

  $('.error').hide();

  var name = $("input#name").val();

   if (name == "") {

    						     $("label#name_error").show();

						     $("input#name").focus();

				               return false;

				    }

	var email = $("input#email").val();

	if (email == "") {

  							$("label#email_error").show();

					          $("input#email").focus();

				               return false;

				     }

	var phone = $("input#phone").val();

	if (phone == "") {

 						     $("label#phone_error").show();

					          $("input#phone").focus();

					          return false;

				       }

  

      var country = $("input#country").val();

	if (country == "") {

  							$("label#country_error").show();

						     $("input#country").focus();

						     return false;

					     } 

					     

	  var dataString = 'name='+ name + '&email=' + email + '&phone=' + phone + '&country=' + country ;



 $.ajax({

			  type: "POST",

			  url: "/"+document.getElementById("dburl").value+"/CreateDocument?OpenAgent",

		       data: dataString,

		       success: function() {

									       $('#success').append("<h3>document has been created successfully</h3>");

									    

								    }

})

return false;					     

					     

});	  

});

  • Step 3 -

LS code to create back-end document ,

Sub Initialize

On Error Goto errHandle



Dim s As New NotesSession 

Dim db As NotesDatabase 

Dim doc As NotesDocument 

Dim tmpdoc As NotesDocument 



Set db=s.CurrentDatabase



Set doc=s.DocumentContext 



Print "Content-Type:text/html"



Set tmpdoc= New NotesDocument(db)



tmpdoc.form="jQueryDemo"

tmpdoc.flddummy=doc.Request_Content(0)



Call	tmpdoc.Save(True,False)



Print "Data Saved................."



Exit Sub

errHandle:

Print " Got error  - " & Error & " at line -  " Cstr(Erl)

Exit Sub

End Sub

Quickly done for you, tested works well . Just a sample one … go through and refer jquery site to go ahead.If still not works mentioned stuffs memo me on rishi.sahi@gmail.com for sample app.

-Rishi