jQuery setFieldValue with autorefresh clearing fields

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

AJDulk
Ebase User
Posts: 94
Joined: Fri Sep 14, 2007 12:18 pm
Location: The Netherlands
Contact:

jQuery setFieldValue with autorefresh clearing fields

#1

Postby AJDulk » Mon Jan 30, 2017 3:25 pm

I have the following:

Code: Select all

	var response = $eb.executeFunction(
		"getDutchAddress",
		[
			$('#senderAdrPostcode').val(),
			$('#senderAdrNumber').val()
		]
	);
	result = $.parseJSON(response);
	if (result.error) {
		$('#senderAdrStreet, #senderAdrCity').val('').prop("readonly", false);
		$eb.setFieldValue("senderAdrStreet", null, false);
		$eb.setFieldValue("senderAdrCity", null, true);
	} else {
		$('#senderAdrStreet, #senderAdrCity').prop("readonly", true);
		$eb.setFieldValue("senderAdrStreet", result.street, false);
		$eb.setFieldValue("senderAdrCity", result.city, true);
	}
When the code is triggered the values of the other fields are set back to null.

What do I need to add to keep the human entered values?
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#2

Postby Jon » Mon Jan 30, 2017 4:20 pm

You want to submit any entered values and set some new fields programatically? If so you should code:

Code: Select all

var response = $eb.executeFunction(
      "getDutchAddress",
      [
         $('#senderAdrPostcode').val(),
         $('#senderAdrNumber').val()
      ], true, true
   ); 
where "true, true" represent refresh the page and submit current values to server respectively.
0 x


Who is online

Users browsing this forum: No registered users and 37 guests